How to get type of user in view?

1

I have an Asp.Net MVC project that uses Individual User Account with Owin . Everything is working perfectly, but I would like to get the user type ( role ) in View . Home I'm using Request.IsAuthenticated to know if the user is authenticated, so is there any way to get the roles of the user?

    
asked by anonymous 08.06.2015 / 15:19

1 answer

2

Man, I think something like that solves your problem.

@if (Request.IsAuthenticated)
{
        @if (User.IsInRole("Admin"))
        {
            <li>
                @Html.ActionLink("Administrativo", "index", "Administrativo")
            </li>
            <li class="nav-divider"></li>
        }

}
    
08.06.2015 / 16:16