CustomError 클래스
HTTP 상태 코드 오류에 대한 ASP.NET 사용자 지정 오류 메시지를 지정합니다.
구문
class CustomError : CollectionElement
메서드
이 클래스에는 메서드가 없습니다.
속성
다음 표에서는 클래스에서 노출하는 속성을 나열합니다 CustomError
.
속성 | Description |
---|---|
Redirect |
사용자 지정 오류 메시지가 포함된 파일 또는 URL의 경로를 포함하는 필수 없음 읽기/쓰기 string 값입니다. |
StatusCode |
HTTP 오류 상태 코드를 지정하는 필수 고유 읽기/쓰기 sint32 값입니다. 유효한 값은 100에서 999까지입니다. 키 속성입니다. |
를 서브클래싱합니다.
이 클래스에는 하위 클래스가 없습니다.
설명
이 클래스의 인스턴스는 CustomErrorsSection 클래스의 속성에 포함 CustomErrors
됩니다.
클래스가 CustomError
나타내는 사용자 지정 오류는 ASP.NET 관련되며 Web.config 파일의 섹션에 있습니다 <system.web>
. HttpErrorElement 클래스로 표시되는 사용자 지정 오류는 IIS 7과 관련이 있으며 ApplicationHost.config 파일의 섹션에 있습니다<system.webServer>
.
예제
다음 예제에서는 기본 웹 사이트의 사용자 지정 오류 섹션에 사용자 지정 오류를 추가합니다.
' Connect to the WMI WebAdministration namespace.
Set oWebAdmin = GetObject("winmgmts:root\WebAdministration")
' Get the CustomError class object.
Set oCustomError = oWebAdmin.Get("CustomError")
' Create a new instance of the CustomError class.
Set oNewCustomError = oCustomError.SpawnInstance_
' Assign values to the StatusCode and Redirect properties.
oNewCustomError.StatusCode = 404
oNewCustomError.Redirect ="CustomPageNotFoundError.htm"
' Get the custom errors section for the default Web site.
Set oSite = oWebAdmin.Get("Site.Name='Default Web Site'")
oSite.GetSection "CustomErrorsSection", oCustomErrorsSection
' Call the CustomErrorsSection.Add method to add the custom error.
oCustomErrorsSection.Add "CustomErrors", oNewCustomError
상속 계층 구조
CustomError
요구 사항
형식 | Description |
---|---|
클라이언트 | - Windows Vista의 IIS 7.0 - Windows 7의 IIS 7.5 - Windows 8의 IIS 8.0 - WINDOWS 10 IIS 10.0 |
서버 | - Windows Server 2008의 IIS 7.0 - Windows Server 2008 R2의 IIS 7.5 - Windows Server 2012의 IIS 8.0 - Windows Server 2012 R2의 IIS 8.5 - WINDOWS SERVER 2016 IIS 10.0 |
제품 | - IIS 7.0, IIS 7.5, IIS 8.0, IIS 8.5, IIS 10.0 |
MOF 파일 | WebAdministration.mof |
참고 항목
CollectionElement 클래스
CustomErrorsSection 클래스
HttpErrorElement 클래스
HttpErrorsSection 클래스