H
H
hugh_bliss2019-02-22 15:25:06
ASP.NET
hugh_bliss, 2019-02-22 15:25:06

How to filter content on a page based on the role of the logged in user in Razor pages in ASP.NET Core2.1?

I need to not show some blocks on the page, depending on the user's role. the official documentation only talks about access to the controller

Answer the question

In order to leave comments, you need to log in

1 answer(s)
H
hugh_bliss, 2019-03-03
@hugh_bliss

@if(User.IsInRole("*RoleName*"){
  <div class="just-in-role-seen"></div>
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question