Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

As the title says - how do I disable all of the ASP.NET unhandled errors appearing in the event log? Cant see anything obvious in IIS / the web.config...

share|improve this question

The easiest way I can think of right now is through a code-based solution, not web.config. In the global.asax file for your application, you can add an Application_Error event handler. In this, you can do whatever you want to do to log the error (or not...) and then redirect to an appropriate error page. Call Context.ClearError() before redirecting, and none of the standard ASP.Net unhandled excpetion stuff will kick in. This is not a pretty way to handle this though, so hopefully somebody else has a better answer.

A simple global.asax that does only this functionality would look like:

<%@ Application Language="C#" %>
<%@ Import namespace="System.Diagnostics" %>
<script runat="server">
protected void Application_Error(object src, EventArgs e)
  Exception ex = Server.GetLastError();
  // do whatever you want to the error itself (ex.Message, etc.)
  // ####
  // clear out the ASP.Net error
  // redirect to an error page


With all that being said, there has to be a way to do this using the web.config healthMonitoring section, I just can't figure out how to say "turn off logging for all events".

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.