What are the definitive guidelines for custom Error Handling in ASP.NET MVC 3?
Posted
by
RyanW
on Programmers
See other posts from Programmers
or by RyanW
Published on 2011-01-21T20:07:28Z
Indexed on
2011/02/07
23:34 UTC
Read the original article
Hit count: 616
The process of doing custom error handling in ASP.NET MVC (3 in this case) seems to be incredibly neglected. I've read through the various questions and answers here, on the web, help pages for various tools (like Elmah), but I feel like I've gone in a complete circle and still don't have the best solution. With your help, perhaps we can set a new standard approach for error handling. I'd like to keep things simple and not over-engineer this.
Here are my goals:
For Server errors/exceptions:
- Display debugging information in dev
- Display friendly error page in production
- Log errors and email them to administrator in production
- Return 500 HTTP Status Code
For 404 Not Found errors:
- Display friendly error page
- Log errors and email them to administrator in production
- Return 404 HTTP Status Code
Is there a way to meet these goals with ASP.NET MVC?
© Programmers or respective owner