CustomError 클래스
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
ASP.NET 오류 코드를 사용자 지정 페이지에 매핑하도록 CustomError 섹션을 구성합니다. 이 클래스는 상속할 수 없습니다.
public ref class CustomError sealed : System::Configuration::ConfigurationElement
public sealed class CustomError : System.Configuration.ConfigurationElement
type CustomError = class
inherit ConfigurationElement
Public NotInheritable Class CustomError
Inherits ConfigurationElement
- 상속
예제
이 예제에서는 클래스의 customErrors 멤버로 액세스할 수도 있는 섹션의 여러 특성에 CustomError 대해 선언적으로 값을 지정하는 방법을 보여 줍니다.
다음 구성 파일 예제에서는 섹션에 대해 선언적으로 값을 지정하는 방법을 보여 있습니다 customErrors .
<customErrors mode="RemoteOnly"
defaultRedirect="customerror.htm">
<error statusCode="404" redirect="customerror404.htm"/>
</customErrors>
다음 코드 예제에서는 클래스를 사용 하는 방법을 보여 줍니다 CustomError .
// Get the Web application configuration.
Configuration configuration =
WebConfigurationManager.OpenWebConfiguration(
"/aspnetTest");
// Get the section.
CustomErrorsSection customErrors =
(CustomErrorsSection)configuration.GetSection(
"system.web/customErrors");
// Get the collection.
CustomErrorCollection customErrorsCollection =
customErrors.Errors;
' Get the Web application configuration.
Dim configuration _
As System.Configuration.Configuration = _
WebConfigurationManager.OpenWebConfiguration( _
"/aspnetTest")
' Get the section.
Dim customErrors As CustomErrorsSection = _
CType(configuration.GetSection( _
"system.web/customErrors"), CustomErrorsSection)
' Get the collection.
Dim customErrorsCollection _
As CustomErrorCollection = _
customErrors.Errors
설명
클래스는 CustomError 프로그래밍 방식으로 액세스 하 고 구성 파일의 섹션을 error 수정 하는 방법을 제공 합니다. 이 형식은 , CustomErrorCollection및 CustomErrorsMode를 포함하는 CustomErrorsSection그룹의 일부입니다.
메모
사용자 지정 오류를 정의할 때 ASP.NET IIS와 같은 기본 서비스에서 일반적으로 발생하는 표준 오류를 할당합니다. 예를 들어 상태 코드 404에 대한 사용자 지정 오류를 정의하는 경우 ASP.NET 기존 .aspx 페이지를 참조할 때마다 발급됩니다. 사용자 지정 오류는 ASP.NET 처리되는 요소에 대해서만 발생합니다. 예를 들어 기존 .htm 페이지를 참조하는 경우 IIS는 표준 404 오류를 발생합니다.
생성자
| Name | Description |
|---|---|
| CustomError(Int32, String) |
CustomError 클래스의 새 인스턴스를 초기화합니다. |