views:

80

answers:

1

Hi,

in the old days, with asp.net, when i would navigate to a non existing page, the .net framework (or iis?) would throw a 404 and i could attach a default page to that error in the web.config in the custom errors section.

but in the asp.net mvc that doesn't seem to work? Does the mvc framework throws some kind of invalid route excpetion saying it can't find any route for my uri or something like that?

+4  A: 

In your routes registration you can add a "catchall" route after your other routes so if no route is matching the current request you can redirect it to a specific controller/action

From another answer in stack overflow:

routes.MapRoute("Error", "{*url}",
        new { controller = "Error", action = "404" }
    );
Gregoire
nice, i'll take this one.
Michel