在ASP.NET MVC4应用程序中,会话过期太快
在我的web.config文件中,会话状态配置如下-
In my web.config file, the session state configuration is as follows-
<sessionState mode="InProc" timeout="540" />
在IIS 7中,会话超时值也为540.但是,会话很快就会过期(在5至15分钟之内).
In IIS 7, session time out value alse 540. But still, session expires very quickly (within 5-15 minutes).
这是一个asp.net mvc 4应用程序.除了login.cshtml之外,所有其他.cshtml视图都通过ajax调用作为局部视图加载.也就是说,首页仅加载一次,所有其他后续页面均在div内加载到首页.
It is an asp.net mvc 4 application. Except login.cshtml, all other .cshtml views are loaded via ajax calls as a partial view. i.e. main home page loads only once and all other subsequent pages are loaded within a div on main home page.
如何摆脱这个问题?
如果您希望网站会话超时而不是删除
if you are want session timeout for website than remove
<authentication mode="Forms">
<forms timeout="50"/>
来自web.config文件的标签.
tag from web.config file.
并添加
<system.web>
<sessionState mode="InProc" timeout="60">
</sessionState>
在web.config文件中
in web.config file
和
void Session_Start(object sender, EventArgs e)
{
Session.Timeout = 60;
}
在Global.asax中
in Global.asax