views:

34

answers:

2

Just struggling with a simple issue with ASP.NET MVC. I have a list of views, each view associated with an Index.aspx view being associated by default with /MyView.

Yet, for some reason I have 1 view named /Mappings that does not work (404 resource is not found) whereas the explicit path /Mappings/Index works.

I have the default route settings as provided by the default ASP.NET MVC sample

routes.MapRoute(
    "{controller}/{action}/{id}",
    new { controller = "Home", action = "Index", id = "" }
);

And, the default Index works for the other views of the same webapp.

Any idea what could be wrong here?

A: 

Have you set a default action value in your route equals to Index ?

Gregoire
+3  A: 

You have to define default action if it is not provided:

route.MapRoute(
            "Default", // Route name
            "{controller}/{action}", // URL with parameters
            new { action = "Index" }  // Default action if not provided
        );

EDIT:

Look at this link:

http://haacked.com/archive/2008/03/13/url-routing-debugger.aspx

You can use this debugger to test your routing.

LukLed
Thank, but unfortunately, my default route is defined. It works with the other views as well. Just one that does not.
Joannes Vermorel