views:

329

answers:

1

Hi All

What is the difference between the customErrors and httpErrors sections of the web.config file in ASP.NET MVC applications?

What are the guidelines for using each section?

Thanks.

Alan T

A: 

Disclaimer: This is from my experience and not proven fact.

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:

Developing in VSDS - use customErrors Publishing the site to IIS6 - use customErrors Publishing the site to IIS7 - use httpErrors.

and if you develop with VSDS but publish to IIS7, then i guess u'll need both.

Pure.Krome