Is it possible to configure a route to be displayed from a root level URL like this?
http: // localhost: 49658 /
I am using the built-in web server VS2010.
Trying to configure a route with a blank or single-slash URL string does not work:
routes.MapRoute( "Default", "/", new { controller = "Home", action = "Index", id = UrlParameter.Optional }
This results in the error "The route URL cannot begin with the character" / "or" ~ ", and it cannot contain the character"? "the character.". Thanks in advance! My definition of the entire route is here:
public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.MapRoute( "EditingTitles", // Route name "{controller}/{action}/{startingLetter}", // URL with parameters new { controller = "Admin", action = "Index", startingLetter = UrlParameter.Optional } // Parameter defaults ); routes.MapRoute( "Default", // Route name "{controller}/{action}/{id}", // URL with parameters new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults ); }
asp.net-mvc routing
blaster
source share