2

I have a redirect on global.asax application_error function. When i'm debugging, every exception is treated by the function. When i am running application on web server, appears the error default page of the IIS. I have IIS7 and Visual Studio 2005.

Best regards!

Sérgio Pinto
  • 21
  • 1
  • 3
  • Related: http://stackoverflow.com/questions/6508415/application-error-not-firing-when-customerrors-on. – Frédéric Hamidi Jul 09 '12 at 18:23
  • @SérgioPinto use server.tranfer("error.aspx"); instead of redirecting. – Nudier Mena Jul 09 '12 at 18:35
  • @Nudier My goal is to write the exception in a log file. Redirect is only to understand if Global.asax is running or not. I tried Server.transfer instead of Response.Redirect but it only redirects on debug too. I dunno if some web.config tag is missing or some configuration on IIS is blocking global.asax, is it possible? – Sérgio Pinto Jul 10 '12 at 08:49

1 Answers1

0

IIS actually also has a fourth type of error page it can show. This page will be returned when you configure HTTP Errors to use a custom error page and a problem occurs when IIS tries to render it.

When IIS received a request for a given page in the demo application, it passes it to the ASP.NET runtime to be handled. The runtime generates a response which IIS then examines. IIS will potentially take action and replace this response if the response has an HTTP status code that is an error status code. - If existingResponse is set to PassThrough, IIS takes no action and the response is returned unaltered. - If existingResponse is set to Replace, IIS replaces the response with its own, according to the value of the errorMode attribute so it will either replace it with a detailed, a basic, or a custom error page. - If existingResponse is set to Auto, IIS replaces the response generated by ASP.NET with its own, unless something called the SetStatus flag is set. (I will discuss that flag later in this post.)

http://perspectivespace.com/error-handling-in-aspnet-mvc-3-part-2-custom

Maslow
  • 18,464
  • 20
  • 106
  • 193