Advertisement
Guest User

Untitled

a guest
Jun 26th, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. [Authorize(Roles="Administrators")]
  2. public class AdminController : Controller
  3. {
  4.  
  5. public IActionResult Index()
  6. {
  7. return View();
  8. }
  9. }
  10.  
  11. @await UserManager.IsInRoleAsync(UserInfo, "Administrators");
  12. // вернет true, UserInfo (мой класс User)
  13.  
  14. @User.IsInRole("Administrators")
  15. // вернет false
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement