【发布时间】:2014-03-25 20:17:52
【问题描述】:
我已设置以下相同的身份验证 cookie:
FormsAuthentication.SetAuthCookie(member.UserName, member.RememberMe);
在 web.config 中:
<authentication mode="Forms"> <forms loginUrl="~/Login" timeout="2" slidingExpiration="true"/> </authentication>
remember 为 true 或 false 时,结果没有区别,用户在 2 分钟后退出。我的问题在哪里? 谢谢
【问题讨论】:
-
你在 web config 中使用 sessionState 并且 timeout="2"
-
@akhlesh 不,它没有。我在 global.asax 中有这段代码:“ void MvcApplication_PostAuthenticateRequest(object sender, EventArgs e) { System.Web.HttpContext.Current.SetSessionStateBehavior(SessionStateBehavior.Required); }”
标签: c# asp.net-mvc-4 cookies login