且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在ASP.NET会话超时

更新时间:2023-02-12 12:16:47

您使用窗体身份验证?

Forms身份验证使用它超时自己的价值(30分钟默认情况下)。表单认证超时将用户发送至登录页面与会话仍然活跃。这可能看起来像当会话超时使它容易张冠李戴与其他您的应用程序提供的行为。

Forms authentication uses it own value for timeout (30 min. by default). A forms authentication timeout will send the user to the login page with the session still active. This may look like the behavior your app gives when session times out making it easy to confuse one with the other.

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

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

设置超时形式的东西不到会话超时可以给用户一个窗口,重新登录,而不会丢失任何会话数据。

Setting the forms timeout to something less than the session timeout can give the user a window in which to log back in without losing any session data.