Get Role name in IdentityUserRole 2.0 in ASP.NET

前端 未结 4 1091
甜味超标
甜味超标 2021-01-17 12:43

Before the update of the dll\'s in the Entity Framework i was able to do this

user.Roles.Where(r => r.Role.Name == \"Admin\").FisrtOrDefault(); 
         


        
4条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-17 13:10

    Ask the RoleMananger?

    RoleManager.Roles.
    // or
    RoleManager.FindByIdAsync()
    // or 
    RoleManager.FindByNameAsync()
    

    You may want to take some time and learn the new security features in Asp.Net Security and Asp.Net Identity.

提交回复
热议问题