I am trying to implement basic role management manually. When a user logs in if they are admin or not they are added to a role
I am getting this error:Except
I tried this in MVC 5 and it worked:
After adding the "roleManager" line shown above to the web.config, I could add a new role and add a user to the role without any exception:
if (!Roles.RoleExists(_role))
Roles.CreateRole(_role);
if (!Roles.IsUserInRole(_username, _role))
Roles.AddUserToRole(_username, _role);