我在共享主机上部署了 asp.net mvc 3 站点。我的问题是我的网站经常在 5 到 10 分钟后自动注销用户。虽然我在 web.config 和 application_start 中将时间设置为 200 分钟,如下所示
<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);
最佳答案
希望这会有所帮助:
关于asp.net-mvc - 用户经常注销(默认成员(member)提供商),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6578611/