ASP.NET

web.config > system.webServer/httpErrors & system.web/customErrors sections

Introduction#

CustomErrors are a legacy (backwards compatable) element, used by Visual Studio Development Server (aka. VSDS or Cassini).

httpErrors are the new element which is only used by IIS7.

What is the difference between customErrors and httpErrors?

Both are used to define error handling for a website, but different software refers to different config elements.

customErrors are a legacy (backwards compatable) element, used by Visual Studio Development Server (aka. VSDS or Cassini).

httpErrors are the new element which is only used by IIS7.

This highlights the possible problem when developing ASP.NET websites while using VSDS instead of the local IIS.

Also, refer to this post by myself about how to handle error messages with IIS7, if you wish to have full control of the error output.

Summary:

  1. Developing in VSDS - use customErrors
  2. Publishing the site to IIS6 - use customErrors
  3. Publishing the site to IIS7 - use httpErrors.
  4. and if you develop with VSDS but publish to IIS7, then i guess u’ll need both.

This modified text is an extract of the original Stack Overflow Documentation created by the contributors and released under CC BY-SA 3.0 This website is not affiliated with Stack Overflow