I am using mvc 5, asp.net 4.5, EF 6 and identity 2.
I met a problem of inserting multiple user data into User Claim Tale
In my controller, after successful user creation i have the below code
await UserManager.AddClaimAsync(user.Id, new Claim("FullName", user.FullName));
By this i can only insert FullName
string in ClaimType
column and user fullname
in ClaimValue
.
But i have insert FullName
, Email
and UserType
and their respective values.
To add multiple claims you can just call AddClaimAsync for each claim you want to add:
await UserManager.AddClaimAsync(user.Id, new Claim("Email", user.Email));
await UserManager.AddClaimAsync(user.Id, new Claim("UserType", user.UserType));