How do I configure ASP.NET MVC routing to hide the controller name on a "home" page?
Try this:
private void RegisterRoutes(RouteCollection routes) {
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute("default", "{controller}/{action}/{id}",
new { action = "index", id = "" },
// Register below the name of all the other controllers
new { controller = @"^(account|support)$" });
routes.MapRoute("home", "{action}",
new { controller = "device", action = "index" });
}
e.g. /foo
If foo
is not a controller then it's treated as an action of the device
controller.