1

I previously had the routes on my MVC4 applications configured using the RouteConfig.cs file found in app start with the following default:

routes.MapRoute(
            name: "Default",
            url: "{controller}/{action}/{id}",
            defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
        );

Having branched my application to allow for Forms authentication having been initially developed using ADFS authentication I needed to change the default URL of the site to:

routes.MapRoute(
            name: "Login",
            url: "{controller}/{action}/{id}",
            defaults: new { controller = "Account", action = "Login", id = UrlParameter.Optional }
        );

This is working in so much that it is taking the user to the Account/Login page initially but where previously the user could type /Admin to get to the Admin/Index page these are no longer applied. How can I reestablish the Index page as the default for the controller while keeping the Account/Login as the primary page

Jay
  • 3,012
  • 14
  • 48
  • 99

1 Answers1

0

You may define a more specific route for the Admin part before your generic route for Login :

routes.MapRoute(
            name: "Default",
            url: "admin/{action}/{id}",
            defaults: new { controller = "Admin", action = "Index", id = UrlParameter.Optional }
        );
jbl
  • 15,179
  • 3
  • 34
  • 101