Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [Authorize(Roles="Administrators")]
- public class AdminController : Controller
- {
- public IActionResult Index()
- {
- return View();
- }
- }
- @await UserManager.IsInRoleAsync(UserInfo, "Administrators");
- // вернет true, UserInfo (мой класс User)
- @User.IsInRole("Administrators")
- // вернет false
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement