1
我爲我的網站使用自定義會員供應商。並使用此代碼登錄:如何在自定義會員供應商中保存ASP.NET_SessionId
private User SetupFormsAuthTicket(string userName, bool persistanceFlag)
{
User user;
UsersContext usersContext = new UsersContext();
user = usersContext.GetUser(userName);
var userId = user.UserId;
var userData = userId.ToString(CultureInfo.InvariantCulture);
var authTicket = new FormsAuthenticationTicket(1, //version
userName, // user name
DateTime.Now, //creation
DateTime.Now.AddMinutes(30), //Expiration
persistanceFlag, //Persistent
userData);
var encTicket = FormsAuthentication.Encrypt(authTicket);
Response.Cookies.Add(new HttpCookie(FormsAuthentication.FormsCookieName, encTicket));
return user;
}
但我檢查的cookie在瀏覽器中,只需保存ASPXAUTH,而不是保存ASP.NET_SessionId
我想保存ASP.NET_SessionId但persistanceFlag是真實的。