I have an ASP.Net MVC 5 application using a new authentication model. Everything seemed to work, but the collection of roles for users always does not contain elements, and User.IsInRole always returns false.
I can successfully add roles to users using UserManager.AddToRole(identity, "Admin");
This gives: http://imgur.com/vobtgO2
The model looks right:
http://imgur.com/0csxrZm
I tried to force Lazy Loading in the Database Context class, but that didn't make any difference.
Are there any additional configuration steps that I need to perform to associate roles with users? I use the IdentityRole class, and my standard ApplicationUser class inherits IdentityUser.
Any help would be greatly appreciated as I have spent too much time on this already.
source
share