用户经常注销(默认会员提供商)

时间:2011-07-05 06:19:15

标签: asp.net-mvc asp.net-mvc-3 asp.net-membership membership-provider

我在共享主机上部署了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);