CustomErrorsSection クラス
ASP.NET カスタム エラー メッセージを構成します。
構文
class CustomErrorsSection : ConfigurationSectionWithCollection
メソッド
次の表に、CustomErrorsSection
クラスによって公開されるメソッドの一覧を示します。
名前 | 説明 |
---|---|
[追加] | (ConfigurationSectionWithCollection から継承。) |
Clear | (ConfigurationSectionWithCollection から継承。) |
Get | (ConfigurationSectionWithCollection から継承。) |
GetAllowDefinition | (ConfigurationSection から継承。) |
GetAllowLocation | (ConfigurationSection から継承。) |
削除 | (ConfigurationSectionWithCollection から継承。) |
RevertToParent | (ConfigurationSection から継承。) |
SetAllowDefinition | (ConfigurationSection から継承。) |
SetAllowLocation | (ConfigurationSection から継承。) |
プロパティ
次の表は、CustomErrorsSection
クラスによって公開されるプロパティの一覧です。
名前 | 説明 |
---|---|
CustomErrors |
ASP.NET カスタム エラーを指定する CustomError 値の配列。 |
DefaultRedirect |
HTTP エラー メッセージ ファイルまたはエラー メッセージの URL の既定のパスを含む、空でない必須の読み取り/書き込みの string 値。 この値は、新しく作成された CustomError オブジェクトの Redirect プロパティによって継承されます。 |
Location |
(ConfigurationSection から継承。)キー プロパティ。 |
Mode |
カスタム エラー ページと既定のエラー ページのどちらがローカルまたはリモートで表示されるかを指定する読み取り/書き込みの sint32 列挙型。 使用できる値の一覧は、後述の「注釈」セクションに示します。 |
Path |
(ConfigurationSection から継承。)キー プロパティ。 |
SectionInformation |
(ConfigurationSection から継承。) |
サブクラス
このクラスにはサブクラスが含まれていません。
解説
CustomErrorsSection
クラスによって表されるカスタム エラーは ASP.NET に固有であり、Web.config ファイルの <system.web>
セクションにあります。 これらの各エラーは、CustomError クラスのインスタンスによって表されます。
HttpErrorsSection クラスによって表されるカスタム エラーは IIS 7 に関連しており、ApplicationHost.config ファイルの <system.webServer>
セクションにあります。 これらの各エラーは、HttpErrorElement クラスのインスタンスによって表されます。 IIS 7 における ASP.NET と IIS の統合により、この名前の変更が必要になりました。
次の表に、Mode
プロパティとして使用できる値の一覧を示します。 既定値は 0 (RemoteOnly
) です。
Value | キーワード | 説明 |
---|---|---|
0 | RemoteOnly |
既定の ASP.NET エラー ページが、ローカル ユーザーに表示されます。 リモート ユーザーには、カスタム エラー ページが定義されている場合に表示されます。 受信したエラーに対してカスタム エラー ページが定義されていない場合は、IIS エラー ページが表示されます。 |
1 | On |
ローカル ユーザーとリモート ユーザーの両方に対して、ユーザー定義の ASP.NET カスタム エラー ページが表示されます。 |
2 | Off |
ローカル ユーザーとリモート ユーザーの両方に対して、既定の ASP.NET エラー ページが表示されます。 |
例
次の例では、DefaultRedirect
プロパティを "CustomError.htm" に設定し、Mode
プロパティを On
に設定します。
' Connect to the WMI WebAdministration namespace.
Set oWebAdmin = GetObject("winmgmts:root\WebAdministration")
' Get the custom errors section for the default Web site.
Set oSite = oWebAdmin.Get("Site.Name='Default Web Site'")
oSite.GetSection "CustomErrorsSection", oSection
' Set the default redirect page to CustomError.htm,
' and set the Mode property to On.
oSection.DefaultRedirect = "CustomError.htm"
oSection.Mode = 1
oSection.Put_
継承階層
ConfigurationSectionWithCollection
CustomErrorsSection
要件
型 | 説明 |
---|---|
クライアント | - 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 |
Product | - IIS 7.0、IIS 7.5、IIS 8.0、IIS 8.5、IIS 10.0 |
MOF ファイル | WebAdministration.mof |
参照
ConfigurationSectionWithCollection クラス
CustomError クラス
HttpErrorElement クラス
HttpErrorsSection クラス