I have some simple views like "About Us" and "Contact Us" that live in the Home controller.
I would prefer the url not have the home part in it like www.xyz.com/ContactUs
instead of www.xyz.com/Home/ContactUs
I added a new route that takes care of this but breaks other controllers when not specifying an action in the url
// Home Routes
RouteTable.Routes.MapRoute("HomeRoute", "{action}", new { controller = "Home", action = "Index" });
// Default
RouteTable.Routes.MapRoute("Default", "{controller}/{action}", new { controller = "Home", action = "Index" });
This is obviously because the route engine can't tell which route to use for a url like www.xyz.com/ContactUs
and uses the 1st one to match.
I also know I can make controllers for each but this seems like a less efficient way. I'd hate to end up with 30 controllers just to wrap one empty view action per view.
I'll probably end up making controllers for each anyway but wanted to know if there is a way to make a route that says something like "If only one parameter is passed, first check to see if it matches a controller, if not assume it's for the home controller."