I have a website that need a departmentID for all sites, so i rewrote the default route to the following:
routes.MapRoute(
name: "Main",
url: "{deptID}/{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", deptID = "", id = UrlParameter.Optional }
);
It works fine when you for example use the following URL:
or just simply:
My problem is that when i go to "http://domain/" i get an error because i dont have specified the departmentID. How can i add a second route which will fire when you just go to the domain.
I have tried to add the following:
routes.MapRoute(
name: "Start",
url: "/",
defaults: new { controller = "Department", action = "Select"}
);
Which doesnt work since you cant just put "/" as an URL.
I have also tried to add the default route and then just change the defaults object:
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Department", action = "Select", id = UrlParameter.Optional }
);
This doesnt work either.

