2
asp.net 프로젝트에서 일하고 있는데 ID 요청의 가치를 업데이트해야합니다.ASP.NET Identity 3.0에서 클레임을 업데이트하는 방법은 무엇입니까?
내가 읽어
How to update a claim in ASP.NET Identity?
내가 비슷하지만 아이덴티티 3.0에서 뭔가를하고 싶다.
asp.net 프로젝트에서 일하고 있는데 ID 요청의 가치를 업데이트해야합니다.ASP.NET Identity 3.0에서 클레임을 업데이트하는 방법은 무엇입니까?
내가 읽어
How to update a claim in ASP.NET Identity?
내가 비슷하지만 아이덴티티 3.0에서 뭔가를하고 싶다.
시도해보십시오.
var identity = new ClaimsIdentity(User.Identity);
identity.RemoveClaim(identity.FindFirst("name"));
identity.AddClaim(new Claim("name", "Jon"));
var authenticationManager = HttpContext.GetOwinContext().Authentication;
authenticationManager.AuthenticationResponseGrant = new AuthenticationResponseGrant(
new ClaimsPrincipal(identity),
new AuthenticationProperties
{
IsPersistent = true
});