I\'m using asp.net Identity 2.0 for users to log into my website, where the authentication details are stored in an SQL database. Asp.net Identity has been implemented in a
I think the main problem still is you don't register the new claims at the ApplicationUser
class.
I was having the same problem and I solved it with a few lines after the CreateIdentityAsync
.
public class ApplicationUser : IdentityUser
{
public async Task GenerateUserIdentityAsync(UserManager manager, string authenticationType)
{
CookieAuthenticationOptions.AuthenticationType
var userIdentity = await manager.CreateIdentityAsync(this, authenticationType);
// Add custom user claims here
userIdentity.AddClaim(new Claim("Code",this.Code));
return userIdentity;
}
//My extended property
public string Code { get; set; }
}