I am trying to make a custom HTTP 404 error page when someone types in a URL
that doesn't invoke a valid action or controller in ASP.NET MVC, instead of it displaying the generic "Resource Not Found" ASP.NET error.
I don't want to use the web.config to handle this.
Is there any kind of routing magic I can do to catch any invalid URLs?
Update: I tried the answer given, however I still get the ugly "Resource Not Found" message.
Another update: Ok, apparently something changed in RC1. I've even tried specifically trapping 404 on an HttpException
and it still just gives me the "Resource Not Found" page.
I've even used MvcContrib's resource's feature and nothing - same problem. Any ideas?
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…