0
我已经实现了登录按钮,如下后1-2分钟:用户被自动注销,被记录在ASP.NET
FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(u.UserID.ToString(), true, 2880);
string encTicket = FormsAuthentication.Encrypt(ticket);
HttpCookie cookie = new HttpCookie(FormsAuthentication.FormsCookieName, encTicket);
cookie.Expires = DateTime.Now.AddMinutes(2880);
Response.Cookies.Add(cookie);
Response.Redirect("/index.aspx");
,这是我的web配置:
<authentication mode="Forms">
<forms loginUrl="Login.aspx" defaultUrl="Index.aspx" slidingExpiration="true" timeout="2880" />
</authentication>
我的问题是:当我将我的Web应用程序部署到托管服务器上时,一旦我登录,我就会在用户目录中几页左右,几乎在30秒 - 1分钟后立即注销并重定向到登录页面我可以重新登录。这是为什么发生?我在我的本地机器上测试过它,它工作得很好?!?!
有人可以帮我解决这个问题吗?