views:

100

answers:

1

Hi,

I don't want to use the default route that vs.net creates:

routes.MapRoute(
    "Default",                                             // Route name
    "{controller}/{action}/{id}",                          // URL with parameters
    new { controller = "Home", action = "Index", id = "" } // Parameter defaults
);

I only want the route to get the www.example.com/ page, what is it? (note: I don't want www.example.com/default just the plain www.example.com to map to HomeController Action=Index).

A: 

I just started playing around with MVC yesterday (the beta version) and I have this in my web config (for IIS 6.0, remove the .aspx for IIS 7.0)

public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
            routes.MapRoute("Default", "{controller}.aspx/{action}/{id}", new { controller = "Home", action = "Index", id = "" });
            routes.MapRoute("Empty", "", new { controller = "Home", action = "Index", id = "" });
        }
Chris
thanks! Is "Empty" hard coded in MVC or what?
Arbitrary name. I also experimented with "Default2", "Blank", etc... and liked "Empty" the best. :P
Chris