14
จะอัพเดตการอ้างสิทธิ์ใน ASP.NET Identity ได้อย่างไร?
ฉันใช้การตรวจสอบสิทธิ์ OWIN สำหรับโครงการ MVC5 ของฉัน นี่เป็นของฉันSignInAsync private async Task SignInAsync(ApplicationUser user, bool isPersistent) { var AccountNo = "101"; AuthenticationManager.SignOut(DefaultAuthenticationTypes.ExternalCookie); var identity = await UserManager.CreateIdentityAsync(user, DefaultAuthenticationTypes.ApplicationCookie); identity.AddClaim(new Claim(ClaimTypes.UserData, AccountNo)); AuthenticationManager.SignIn(new AuthenticationProperties() { IsPersistent = isPersistent, RedirectUri="Account/Index"}, identity); } อย่างที่คุณเห็นฉันได้เพิ่มAccountNoเข้าไปในรายการการอ้างสิทธิ์ ตอนนี้ฉันจะอัปเดตการอ้างสิทธิ์นี้ในแอปพลิเคชันของฉันได้อย่างไร จนถึงตอนนี้ฉันมีสิ่งนี้: public string AccountNo { get { var CP = ClaimsPrincipal.Current.Identities.First(); …