tags:

views:

35

answers:

3

Hello

I have this route registered:

routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

        routes.MapRoute(
            "Views", "View/{RouteID}", 
            new { controller = "BookingViewsPublicController", 
                action = "Index", RouteID = "" }
                );


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

And I cant get like http://localhost:49764/View/Foo to work, I still have to go to /BookingViewsPublic/?RouteID=Foo for it to work. What might be wrong?

/M

A: 
  1. Remove the default value for "RouteID"

    routes.MapRoute( "Views", "View/{RouteID}", new { controller = "BookingViewsPublicController", action = "Index" } );

  2. Try using Phil Haack's excellent routing debugger.

HTH,
indyfromoz

indyfromoz
I used the debugger and it matches correctly if I go to /View/100procent. But if I have RegisterRoutes(RouteTable.Routes); it doesnt work
molgan
+1  A: 

Resolved

"BookingViewsPublic" not "BookingViewsPublicController" in route-registration

molgan
Great to hear! Sometimes we do not need to look for complex solutions :)
indyfromoz
A: 

Problem was that I had the word "Controller" in the route, so BookingViewsPublic and NOT BookingViewsPublicController.

molgan