我正在尝试在asp.net项目上记住我的系统。我做了用户注册并登录FormsAuthenticationTicket。我想要的是当用户登录时,我按预期设置了持久性cookie,我验证我可以添加cookie,但FormsAuthenticationTicket不会处理记忆事物。这是我的代码
ticket = new FormsAuthenticationTicket(1,
(String)(drUserInfo["Email"]),
DateTime.Now,
DateTime.Now.AddMinutes(30),
Login1.RememberMeSet,
(String)(drUserInfo["UserType"]));
encryptedStr = FormsAuthentication.Encrypt(ticket);
你能帮我解决这个问题吗? FormsAuthenticationTicket是否处理了记忆我系统或我?
答案 0 :(得分:0)
浏览asp的源代码:登录我看到cookie是通过以下调用来实现的:
从System.Web.UI.WebControls.Login.AttemptLogin
调用if (authenticateEventArgs.Authenticated)
{
FormsAuthentication.SetAuthCookie(this.UserNameInternal, this.RememberMeSet);
this.OnLoggedIn(EventArgs.Empty);
this.Page.Response.Redirect(this.GetRedirectUrl(), false);
return;
}
FormsAuthentication.SetAuthCookie(this.UserNameInternal, this.RememberMeSet);
是电话