Compartilhar via


httpErrors Element [IIS Settings Schema]

Note

For more information about the httpErrors element, see the following topic on the Microsoft IIS.net Web site: HTTP Errors <httpErrors>.

Configures HTTP error messages for a Web server.

Syntax

Attributes and Elements

The following sections describe attributes, child elements, and parent elements for this section.

Attributes

Attribute

Description

defaultPath

Optional string attribute.

Specifies the default path of the custom error page. The type of path is determined by the defaultResponseMode attribute. If you choose File, the file path is returned. If you choose either the ExecuteURL or Redirect path type, the URL of the custom error page is returned.

defaultResponseMode

Optional enum attribute.

Specifies how custom error content is returned.

The defaultResponseMode attribute can be one of the following possible values. The default is File.

ValueDescription
FileServes static content, for example, a .html file for the custom error. If responseMode is set to File, the path value has to be a file path. The numeric value is 0.
ExecuteURLServes dynamic content, for example, a .asp file for the custom error. If responseMode is set to ExecuteURL, the path value has to be a server relative URL. The numeric value is 1.
RedirectRedirects client browsers to a different URL that contains the custom error file. If responseMode is set to Redirect, the path value has to be an absolute URL. The numeric value is 2.

detailedMoreInformationLink

Optional string attribute.

Specifies a link, shown at the bottom of the page, to a page with more detailed information about a particular error. You can use this property to point end users to a custom location for error information. The status, sub-status, hresult and message ID are sent as part of the query string.

The default value is "https://go.microsoft.com/fwlink/?LinkID=62293".

errorMode

Optional enum attribute.

Specifies whether HTTP errors are enabled.

The errorMode attribute can be one of the following values. The default is DetailedLocalOnly.

ValueDescription
DetailedLocalOnlyReturns detailed error information if the request is from the local computer, and returns a custom error message if the request is from an external computer. The numeric value is 0.
Custom Replaces the error that the module or server generates with a custom page that you specify. This mode is useful in providing friendlier error messages to end users. The numeric value is 1.

Note

This setting turns off detailed errors, even for local requests.

DetailedSends detailed error information back to the client. This mode is useful for testing and debugging Web sites and applications. The numeric value is 2.

existingResponse

Optional enum attribute.

Specifies what happens to an existing response when the HTTP status code is an error, i.e. response codes >= 400.

ValueDescription
AutoLeaves the response untouched only if the SetStatus flag is set. The numeric value is 0.
ReplaceReplaces the existing response even if the SetStatus flag is set. The numeric value is 1.
PassThroughLeaves the response untouched if an existing response exists. The numeric value is 2.

Child Elements

Element

Description

error

Optional element.

Adds an HTTP error to the collection of HTTP errors.

remove

Optional element.

Removes a reference to an HTTP error from the HTTP error collection.

clear

Optional element.

Removes all references to HTTP errors from the HTTP error collection.

Parent Elements

Element

Description

configuration

Specifies the root element in every configuration file that is used by IIS 7.

system.webServer

Specifies the top-level section group (in ApplicationHost.config) in which this element is defined.

Remarks

For more information about the httpErrors element, see the following topic on the Microsoft IIS.net Web site: HTTP Errors <httpErrors>.

Element Information

Configuration locations

Machine.config

ApplicationHost.config

Root application Web.config

Application Web.config

Directory Web.config

Requirements

Microsoft Internet Information Services (IIS) version 7.0

See Also

Reference

error Element for httpErrors [IIS Settings Schema]