mvc3 如何增加登录时间,我试过了,但错了



我一直在尝试延长每个登录用户的登录时间,但由于某种原因,在 15 到 20 分钟左右后,它会将我注销。我想将注销时间缩短到 300 分钟,因为人们实际上在网站上创建文章,所以他们需要时间,到目前为止我所拥有的是这个......

 // this is when users login i want the timeout to be 300 minutes automatically
  FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(model.Email, model.RememberMe, 300);
                    string encTicket = FormsAuthentication.Encrypt(ticket);
                    Response.Cookies.Add(new HttpCookie(FormsAuthentication.FormsCookieName, encTicket)); 

这是我的 web.config

    <authentication mode="Forms">
  <forms name=".loog" loginUrl="~/Account/login" timeout="300" protection="All" path="/" requireSSL="false" slidingExpiration="true" cookieless="AutoDetect"/>
</authentication>

我每20分钟注销一次的原因可能是什么..任何帮助都会很棒!

试试这个

web.config

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

参考

相关内容

最新更新