Sunday, 2 July 2017

ASP.NET MVC - How to hide or Show a link/button based on logged in User's Role permission?

For example, you can do it in a way like this:
@if (ViewContext.HttpContext.User.IsInRole("Your role"))
{
    // Do something here
}

No comments:

Post a Comment

Note: only a member of this blog may post a comment.