Share via


HttpErrorElement Class [IIS 7 and higher]

Configures the response to a specific HTTP error.

Syntax

class HttpErrorElement : CollectionElement

Methods

This class contains no methods.

Properties

The following table lists the properties exposed by the HttpErrorElement class.

Name

Description

Path

A required read/write string value that contains the file name or URL that is served in response to the HTTP error specified by the StatusCode and SubStatusCode properties.

PrefixLanguageFilePath

An optional read/write string value that specifies the physical path of a custom error page directory. The custom error page directory contains one or more language-specific subdirectories with custom error pages for the error specified in the StatusCode property.

The file path is constructed as follows: PrefixLanguageFilePath\ClientLanguageID\CustomErrorPageFile. For example, PrefixLanguageFilePath might be "%SystemDrive%\inetpub\custerr", ClientLanguageID might be "en-us" and CustomErrorPageFile (specified by the Path property) might be "401.htm".

NoteNote:
Custom errors are language-specific and typically return the custom error in the system language of the client. For an error page to be returned in a language different from the system language of the client, the language pack for that language must be installed on the client. For example, if PrefixLanguageFilePath is "d:\inetpub\custerr" and the client has the en-US language pack installed, the resulting path for error code 404 is d:\inetpub\custerr\en-us\404.htm when the client browser sends "en-us" in the Accept-Language header. However, if ja-JP is the system language, and the en-US language pack is not installed, the resulting path is d:\inetpub\custerr\ja-jp\404.htm.

ResponseMode

A required read/write sint32 value that specifies the response to the HTTP error specified by StatusCode and SubStatusCode. The possible values are listed later in the Remarks section.

StatusCode

A required unique read/write uint32 value that contains a status code from 400 through 999. A key property.

SubStatusCode

A required unique read/write sint32 value that contains a substatus code from –1 through 999. The default is –1. A key property.

Subclasses

This class contains no subclasses.

Remarks

Instances of this class are contained in the HttpErrors array property of the HttpErrorsSection class.

This class represents an <error> element in the <httpErrors> section of the ApplicationHost.config file.

The following table contains the possible values and keywords for the ResponseMode property. The default is 0 (File).

Value

Keyword

Description

0

File

The Web server returns the Web page specified in the Path property.

1

ExecuteURL

The Web server returns the ASP page specified in Path.

2

Redirect

The Web server redirects the request to the URL specified in Path.

Inheritance Hierarchy

CollectionElement

   HttpErrorElement

Requirements

Type

Description

Client

Requires IIS 7 on Windows Vista.

Server

Requires IIS 7 on Windows Server 2008.

Product

IIS 7

MOF file

WebAdministration.mof

See Also

Reference

CollectionElement Class [IIS 7 and higher]

HttpErrorsSection Class [IIS 7 and higher]

Other Resources

Configuring Custom Error Messages

IIS Status Codes