Tas*_*que 5 asp.net-mvc asp.net-membership membership-provider asp.net-mvc-3
我在共享主机上部署了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);
Run Code Online (Sandbox Code Playgroud)