asp.net-mvc - 用户经常注销(默认成员(member)提供商)

标签 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);

最佳答案

关于asp.net-mvc - 用户经常注销(默认成员(member)提供商),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6578611/

相关文章:

.net - 加密应用服务连接字符串

c# - 捕获显示信息的异常

asp.net-mvc - 单元测试自定义模型绑定(bind)器 - 假 HttpContext 问题

c# - Asp.Net View 呈现意外输出

asp.net-mvc - 获取 View 名称,其中 ViewResult.ViewName 为空字符串以进行单元测试

asp.net-mvc-3 - 在 ASP.NET MVC3 应用程序中是否可以同时拥有多个身份验证提供程序?

c# - asp.net mvc 获取关系数据的更好方法

javascript - 填充每行前面的复选框,并使用 json 和 jquery 发送选中/未选中的值和 ID

c# - 将用户的登录方法保存在cookie中?

asp.net-mvc - 使用 ASP.Net Membership,获取所有用户