Hi folks,
I have the following route's defined:
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
"Default",
"{controller}/{action}/{id}",
new { controller = "Home", action = "Index", id = "" }
);
// Added custom route here!
routes.MapRoute(
"CatchAll",
"{*catchall},"
new { controller = "Error", action = "NotFound" }
);
}
nothing new - that's the default ASP.NET MVC1 RegisterRoutes
method, with one custom route added.
Now, if I goto the following url, i get a 404...
http://whatever/Home/MissingActionMethod
So there's no ActionMethod
called MissingActionMethod
in the HomeController
. So, does this mean, if i goto the 1st route defined, above .. and fail to find an action .. do I then come back and try the second route? rinse-repeat?
Or once i match a route, i then try and execute that route .. and if i fail (ie, find the action is missing) .. then .. bad luck? boomski?
cheers!
EDIT/UPDATE:
Thanks heaps for the replies, but they are not reading my question properly :( I know 1) order of routes are important b) haack's route debugger
but my question is not about that. I'm asking that .. if the first route is 'handled' .. but fails .. does it then go down the list to the next one?
So, in my example above. The first route called 'Default' is matched against the url/resource requested ... but when the framework tries to find an action, which is missing .. it 404's.
So .. does that mean the framework first matches the "default" route .. tries it .. fails .. goes BACK to the route list .. tries to find the next route that matches .. and finally fails so it then gives up?
Or it only finds the first and only the first route it matches .. and if it fails to find the controller and/or action .. then it just gives up there and then? (This is what i suspect). And if so .. how does it then figure out how to 404?
Update #2:
Phil Haack actually talks about my question, a bit ... but doesn't answer the part I was curious about -> how and where it determines a 404 resource not found.