The Role Manager feature has not been enabled

Viewed 136799

Got the following ProviderException :

The Role Manager feature has not been enabled.

So far so good.

Is there somewhere a method that can be called to check if the Role Manager has been enabled or not?

7 Answers

Here is the code that you need to put in your Account Controller in MVC5 and later to get the list of roles of a user:

csharp public async Task<ActionResult> RoleAdd(string UserID) { return View(await UserManager.GetRolesAsync(UserID)).OrderBy(s => s).ToList()); }

There is no need to use Roles.GetRolesForUser() and enable the Role Manager Feature.

Related