0

We have an ASP.NET MVC application, and when it encounters an error you are not redirected to an erro rpage, instead the content of that page is replaced with the content of the error page. You go fix your code and press refresh and you're done.

We have another application that's written in WebForms and I'd like to get the same behavior out of it. Right now the current behavior is that when an error occurs you get redirected to ~/Error.aspx. Is it possible to make webforms behave this way? Perhaps override the page render event somehow?

John Saunders
  • 160,644
  • 26
  • 247
  • 397
Chris Barr
  • 29,851
  • 23
  • 95
  • 135
  • 1
    I have edited your title. Please see, "[Should questions include “tags” in their titles?](http://meta.stackexchange.com/questions/19190/)", where the consensus is "no, they should not". – John Saunders Sep 27 '14 at 21:25

1 Answers1

0

This is just for development right? Displaying the error.aspx on production is much better both from a security and user experience perspective.

In order to turn off custom errors, you need to know how to turn them on. Yes? There are several places custom errors can be configured.

  1. in IIS Create a Custom HTTP Error Response (IIS 7)
  2. an error handler on the page, in global.asax, or in a class defined elsewhere (app_code folder perhaps)
  3. in web.config Web.config customErrors mode

Web.config is probably the most common place. Start there.

Community
  • 1
  • 1
lurker
  • 159
  • 6