Skip to content

Question: Accessing user's roles in razor #26

Description

@cubski

I've been using MemFlex with MySQL and haven't had any major issues thus far. I'm using roles to authorize certain users within my app, I'm able to check the user's role on the server side but I wasn't able to do the same on my web pages using razor.

@if(User.IsInRole("Admin"))
{
@Html.ActionLink("Manage", "Index", "Dashboard")
}

The snippet seems to be using the default SQL Server membership provider and not MemFlex. Any guidance on how to hook it up?

Also, I was able to use MemFlex in authorizing users in Web API with a custom authorization filter. I'm not sure if a similar method can be applied to my question.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions