The Role Manager feature has not been enabled

后端 未结 7 803
再見小時候
再見小時候 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:25

    If you are using ASP.NET Identity UserManager you can get it like this as well:

    var userManager = Request.GetOwinContext().GetUserManager();
    
    var roles = userManager.GetRoles(User.Identity.GetUserId());
    

    If you have changed key for user from Guid to Int for example use this code:

    var roles = userManager.GetRoles(User.Identity.GetUserId());
    

提交回复
热议问题