用户掉线的故障(默认成员资格提供) [英] user logged out frequently (Default Membership provider)
本文介绍了用户掉线的故障(默认成员资格提供)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有asp.net的MVC 3,现场部署在共享主机。我的问题是,我的网站频繁后5〜10分钟自动注销用户。虽然我已经设置了时间在web.config中和的Application_Start 200分钟如下图所示。
<形式loginUrl =〜/ Account.mvc /指数slidingExpiration =真正的超时=200保护=全部/>的HttpCookie authCookie = FormsAuthentication.GetAuthCookie(用户名,与rememberMe);
的FormsAuthenticationTicket票= FormsAuthentication.Decrypt(authCookie.Value);
的FormsAuthenticationTicket newTicket =新的FormsAuthenticationTicket(1,用户名,DateTime.Now,DateTime.Now.AddMinutes(200),与rememberMe,CurrentUser.UserID +|+ CurrentUser.EmployeeID);
authCookie.Value = FormsAuthentication.Encrypt(newTicket);
Response.Cookies.Add(authCookie);
解决方案
我们希望,这将有助于:
- <machineKey decryptionKey =&QUOT;自动生成&QUOT; ...由IIS被忽略。会不会作废previous会议的饼干
- http://msdn.microsoft.com/en-us/library/ ff649308.aspx
I have asp.net mvc 3 site deployed on shared hosting. My problem is that my site frequently logged out user automatically after 5 to 10 min. Although i have set the time to 200 min in web.config and application_start as shown below
<forms loginUrl="~/Account.mvc/index" slidingExpiration="true" timeout="200" protection="All" />
HttpCookie authCookie = FormsAuthentication.GetAuthCookie(userName, rememberMe);
FormsAuthenticationTicket ticket = FormsAuthentication.Decrypt(authCookie.Value);
FormsAuthenticationTicket newTicket = new FormsAuthenticationTicket(1, userName, DateTime.Now, DateTime.Now.AddMinutes(200), rememberMe, CurrentUser.UserID +"|"+ CurrentUser.EmployeeID);
authCookie.Value = FormsAuthentication.Encrypt(newTicket);
Response.Cookies.Add(authCookie);
解决方案
Hopefully, this will help:
- <machineKey decryptionKey="AutoGenerate"... being ignored by IIS. Won't invalidate previous session's cookies
- http://msdn.microsoft.com/en-us/library/ff649308.aspx
这篇关于用户掉线的故障(默认成员资格提供)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文