ASP.NET 中的会话超时 [英] Session timeout in ASP.NET
问题描述
我正在 IIS 6.0 中运行 ASP.NET 2.0 应用程序.我希望会话超时为 60 分钟,而不是默认的 20 分钟.我做了以下
I am running an ASP.NET 2.0 application in IIS 6.0. I want session timeout to be 60 minutes rather than the default 20 minutes. I have done the following
- 设置
在web.config
中. - 在 IIS 管理器/网站属性/ASP.NET 配置设置中将会话超时设置为 60 分钟.
- 在应用程序池属性/性能中将空闲超时设置为 60 分钟.
我仍然在 20 分钟时遇到会话超时.我还有什么需要做的吗?
I am still getting a session timeout at 20 minutes. Is there anything else I need to do?
推荐答案
您是否使用表单身份验证?
Are you using Forms authentication?
表单身份验证使用自己的超时值(默认为 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.
这篇关于ASP.NET 中的会话超时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!