dre
dre

Reputation: 1434

ASP.NET MVC 3 Error and Exception Handling with 404

What is the best way to log an exception and give the user the error code that was logged. Along with this how are 404 errors handled. I have seen many solutions for both but not together in a way that fits nicely with the mvc model. Do you have an example too? Also for 404's is there a way to get the 404 even if the user hasn't logged in to the app?

Is elmah something that should be used in production? Is there a nuget package that people suggest using?

Upvotes: 0

Views: 519

Answers (1)

Erik Funkenbusch
Erik Funkenbusch

Reputation: 93424

Yes, use elmah, but make sure that access to the log viewer is controlled.

The package is Elmah.MVC, and make sure you read these:

http://www.hanselman.com/blog/ELMAHErrorLoggingModulesAndHandlersForASPNETAndMVCToo.aspx http://dotnetdarren.wordpress.com/2010/07/27/logging-on-mvc-part-1/

Upvotes: 1

Related Questions