我有个问题。我已经使用 cookie 完成了自定义的“记住我”功能。
HttpCookie rememberMeCookie = FormsAuthentication.GetAuthCookie(userName, rememberMe);
if (rememberMe)
{
rememberMeCookie.Expires = Controller.LocalizationProvider.GetAdjustedServerTime().AddMonths(6);
}
HttpContext.Current.Response.Cookies.Add(rememberMeCookie);
我在 Firefox 的 firecookies 工具中看到了 cookie。它存在并具有正确的到期日期。但是当我改变时间 - 移动到下个月。之后,我进入该站点并取消了用户登录。如果我回到现在 - 我成为了认证用户。