Author: .NET Web Development and Tools Blog | Posted on: 7/16/2013 4:34:33 PM | Views : 1394

System.Diagnostics.Trace can be a useful tool for logging and debugging, and sometimes it would be handy to be able to call one of the tracing methods from a Razor view. For example, when an MVC application runs in production, by default MVC catches most application exceptions for you and routes them to Views/Shared/Error.cshtml. That view doesn’t show error details for security reasons, so you end up with the not-very-helpful message “An error occurred while processing your request.”   Running locally you get detailed error info, or you can catch exceptions by running in debug mode, but what to do about errors that happen in production?  If you can re-create the error in production, you can temporarily tell the site to go ahead and...(read more) ...

Go to the complete details ...