1

I would like to edit my 'Error' page so that whenever an error is thrown it displays the reason why.

Instead of the default:

Error. An error occurred while processing your request.

It would say e.g.:

Error. An error occurred while processing your request.

Reason: "Unable to connect to database 'MVCDatabase'."

Is there a way of making it so that the 'Error' view would show this?

Community
  • 1
  • 1
Jack Allen
  • 549
  • 2
  • 5
  • 19
  • 2
    Take a look here: http://stackoverflow.com/questions/812235/error-handling-in-asp-net-mvc. You could call the `HttpServerUtility.GetLastError` method in the View code and render the `Message` property of the exception. – Dan May 02 '13 at 00:01

1 Answers1

1

You can use custom error messages and by using a little designing i.e giving them red colour you can store them as a variable in your model class and then simply show them on your page without breaking the visual layout and flow

Chirag K
  • 2,394
  • 2
  • 16
  • 23