Search code examples
c#asp.net-mvcwindows-authentication

MVC 3.5 Windows Authentication on View


I am currently using built in Windows Authentication for my MVC3 web app.

It works as expected but I can't seem to figure out how to hide certain links on a view based on what user is logged in. I found info on using If (Roles.IsUserInRole) but that dont work as I do not know that Windows roles if any we are using. I think we are using Groups instead of roles.

Thanks


Solution

  • Role = group membership, so you can use it like this:

    if (Roles.IsUserInRole("domain\\Administrators")) {
    // do something
    }