Đây là chức năng của tôi được gọi khi đăng nhập thành công. (Tôi rất mới để điều FormAuthentication này)FormsAuthenticationTicket hết hạn quá sớm
public static void CreateLoginCookie(User u)
{
FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(u.Id.ToString(), true, 9*60);
string encryptedTicket = FormsAuthentication.Encrypt(ticket);
HttpCookie cookie = new HttpCookie(FormsAuthentication.FormsCookieName, encryptedTicket) { Expires = DateTime.Now.AddHours(9) };
HttpContext.Current.Response.Cookies.Add(cookie);
}
Trong web.config Tôi có
<authentication mode="Forms">
<forms loginUrl="~/Default/Login" timeout="540" />
</authentication>
Tôi muốn nghỉ dùng đăng nhập trong 9 giờ, nhưng nó không hoạt động. Họ bị đăng xuất sau một hoặc hai giờ.
Ai đó có thể cho tôi biết những gì tôi đang thiếu?
Bạn có chắc chắn đó là vé và không phải là phiên đó là hết hạn? –