私のプロジェクトでは、FormAuthenticationTicket の代わりにカスタム オブジェクトを使用する必要があります。FormAuthenticationTicket と同じプロパティを持つカスタム オブジェクトを作成しました。ここで、独自の暗号化方法を使用して、このカスタム オブジェクトを暗号化します。FormAuthentication Cookie が正常に作成されました。しかし、context.User.Identity.IsAuthenticated プロパティを確認すると、常に false のままです。これがコードです。
CookieData cookieData = new CookieData();
cookieData.ExpirationDate = DateTime.Now.AddMinutes(CookieConstants.DefaultFormsAuthTicketTimeout);
cookieData.LoginToken = LoginToken;
cookieData.Impersonate = (IsImpersonate ? true : false);
cookieData.IsPersistent = IsPersistent;
cookieData.UserData = "<<UserRelated Information>>";
JavaScriptSerializer js = new JavaScriptSerializer();
string strCookieData = js.Serialize(cookieData);
string encryptedTicket = AESEncryption.Encrpyt(strCookieData);
HttpCookie httpCookie = null;
httpCookie = new HttpCookie(cebCookie.Name, encryptedTicket);
if (cebCookie.IsPersistent)
{
httpCookie.Expires = cebCookie.Expires;
}
if (!string.IsNullOrEmpty(cebCookie.Url))
{
httpCookie.Secure = cebCookie.RequireSSL;
httpCookie.Domain = cebCookie.Domain;
}
httpCookie.Path = FormsAuthentication.FormsCookiePath;
HttpContext.Current.Response.Cookies.Set(httpCookie);
これが有線の要件であることはわかっています。助けてください。