C# ASP.NET中的会话超时问题

C# ASP.NET中的会话超时问题,c#,.net,asp.net,.net-4.0,session-state,C#,.net,Asp.net,.net 4.0,Session State,我已经阅读了一些与会话超时相关的问题,我已经更改了设置,但没有效果 这是web.config中的会话条目。我想在5小时后终止会话 <sessionState mode="InProc" timeout="300" /> 我的每个页面都是用BasePage继承的,在基类中,我对每个页面都有这个检查 if (Session["Authenticated"] == null) { Response.Redirect("../userlogin.aspx"); } 但会话将在一小时

我已经阅读了一些与会话超时相关的问题,我已经更改了设置,但没有效果

这是web.config中的会话条目。我想在5小时后终止会话

<sessionState mode="InProc" timeout="300" />
我的每个页面都是用BasePage继承的,在基类中,我对每个页面都有这个检查

if (Session["Authenticated"] == null)
{
   Response.Redirect("../userlogin.aspx");
}
但会话将在一小时前过期


我想确认在此期间,web.config、Bin文件夹文件等没有更改。

如果您在IIS6(Win2K3)上托管它,请转到应用程序运行所在的应用程序池中的设置。您还需要将它设置在那里。

看看这个

除了IIS空闲超时之外,还有表单身份验证超时,默认为30分钟。因此,在会话实际过期之前,您将被重定向到登录页面

<system.web>
    <authentication mode="Forms">
         <forms timeout="300"/>
    </authentication>

    <sessionState timeout="300"  />
</system.web>

<system.web>
    <authentication mode="Forms">
         <forms timeout="300"/>
    </authentication>

    <sessionState timeout="300"  />
</system.web>