【发布时间】:2011-06-27 18:23:32
【问题描述】:
我正在尝试更改会话到期所需的时间。我的观点正在验证与<Authorize()> 的会话,效果很好。
我正在按如下方式创建会话:
FormsAuthentication.SetAuthCookie(model.UserName, True)
Return RedirectToAction("Welcome", "Home")
我的密码已通过验证
FormsAuthentication.Authenticate(username, password)
我的路由 web.config 包含在 system.web 中
<sessionState timeout="7200"></sessionState>
我的授权节点如下:
<authentication mode="Forms">
<forms loginUrl="~/Home/Login" timeout="7200" cookieless="UseCookies" name=".LoginCookie" slidingExpiration="true" >
<credentials passwordFormat="Clear">
<user name="user" password="pass" />
</credentials>
</forms>
</authentication>
登录后,我什至可以验证特定 cookie 'LoginCookie' 是否设置为在几天后过期,但如果我 30 分钟不活动,我的用户将被发送到登录页面。
最后,这在 Visual Studio 中似乎可以正常工作,就像在我做过的网站上一样,但由于某种原因,一旦在 IIS 中它就不能(生产环境)。
非常感谢我可能错过的任何帮助。
【问题讨论】:
标签: asp.net authentication session-state