The Role Manager feature has not been enabled

后端 未结 7 837
再見小時候
再見小時候 2020-12-04 11:50

Got the following ProviderException :

The Role Manager feature has not been enabled.

So far so good.

Is there somewher

7条回答
  •  感动是毒
    2020-12-04 12:27

    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 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.

提交回复
热议问题