I am using RC2
Using URL Routing:
routes.MapRoute(
\"Error\",
\"{*url}\",
new { controller = \"Errors\", action = \"N
Posting an answer since my comment was too long...
It's both a comment and questions to the unicorn post/answer:
https://stackoverflow.com/a/7499406/687549
I prefer this answer over the others for it's simplicity and the fact that apparently some folks at Microsoft were consulted. I got three questions however and if they can be answered then I will call this answer the holy grail of all 404/500 error answers on the interwebs for an ASP.NET MVC (x) app.
@Pure.Krome
Can you update your answer with the SEO stuff from the comments pointed out by GWB (there was never any mentioning of this in your answer) -
and
?
Can you ask your ASP.NET team friends if it is okay to do it like that - would be nice to have some confirmation - maybe it's a big no-no to change redirectMode
and existingResponse
in this way to be able to play nicely with SEO?!
Can you add some clarification surrounding all that stuff (customErrors redirectMode="ResponseRewrite"
, customErrors redirectMode="ResponseRedirect"
, httpErrors errorMode="Custom" existingResponse="Replace"
, REMOVE customErrors
COMPLETELY as someone suggested) after talking to your friends at Microsoft?
As I was saying; it would be supernice if we could make your answer more complete as this seem to be a fairly popular question with 54 000+ views.
Update: Unicorn answer does a 302 Found and a 200 OK and cannot be changed to only return 404 using a route. It has to be a physical file which is not very MVC:ish. So moving on to another solution. Too bad because this seemed to be the ultimate MVC:ish answer this far.