Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the direct cause and source of the "Sorry, an error occurred while processing your request." message?

There are many inquiries out there about the ASP.Net MVC error "Sorry, an error occurred while processing your request". Unfortunately, I was not able to find any that actually discuss what is really occurring. Understandably they focus on the underlying error rather than the immediate source and cause of the message. Consequently these solutions give widely varying answers to the same question.

Here are a few examples:

  • Sorry, an error occurred while processing your request. in MVC3 Model Entities

  • Sorry, an error occurred while processing your request C# and Ajax

  • http://forums.asp.net/t/1661793.aspx/1/10?Sorry+an+error+occurred+while+processing+your+request+

  • http://forums.gbpvr.com/showthread.php?53184-Sorry-an-error-occurred-while-processing-your-request

Based on the stack trace data in many of the answers I researched it appears that this may be triggered in the System.Web.Mvc.ControllerActionInvoke class. It seems in general to be a direct result of an unhandled error in the executing ActionResult method.

I'd like to understand the term "processing your request" in the message. Based on the way I've seen the error display, it seems unlikely that this is referring to the HTTP Request. Perhaps something more granular in the MVC architecture? Can someone shed some more light on where this message originates and why?

like image 240
Rich C Avatar asked Jun 14 '13 03:06

Rich C


1 Answers

The default error handling of an out-of-box ASP.Net MVC Application redirects errors to the Error.aspx shared view. You will find the "Sorry, an error occurred while processing your request" message text inside the Error.aspx file. The message is not generated from a .Net class.

The following SO question brought me to the light: ASP.NET MVC HandleError not working (customErrors is set to "On")

To see more details about the underlying error you have a few options.

  • Customize the default Error.aspx page to display details about the underlying error.

  • Turn off the CustomErrors in the web.config file. Future errors should display the default ASP.Net "yellow screen" error details instead of the "Sorry, an error occurred message".

  • Handle the error specifically in the associated ActionResult method.

like image 106
Rich C Avatar answered Nov 02 '22 19:11

Rich C