Search code examples
asp.netasp.net-mvcwindows-authentication

ASP.NET Windows Authentication routing different groups


I'm trying to set up an application that will route to different areas of my application based on their groups in Active Directory using Windows Authentication.

For example, I have a user that is in an Admin group gets routed to one area, and a User group that gets routed to another.
All users will enter the app using the same url, but based on the group they are in it will forward them to their proper areas.

I'm not sure where this is handled? If anyone has a link of a scenario where this question is already answered that would be great.

Any help and guidance is appreciated and let me know if you need more information or if I am unclear in this description.


Solution

  • Role/group based routing is not supported by ASP.NET MVC, you can redirect to appropriate action in your Home Controller Index like following.

    if (User.IsInRole("Admin"))
    {
        return RedirectToAction("Index", "AdminController");
    }