CustomErrorsSection クラス
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
ASP.NET カスタム エラーを構成します。 このクラスは継承できません。
public ref class CustomErrorsSection sealed : System::Configuration::ConfigurationSection
public sealed class CustomErrorsSection : System.Configuration.ConfigurationSection
type CustomErrorsSection = class
inherit ConfigurationSection
Public NotInheritable Class CustomErrorsSection
Inherits ConfigurationSection
- 継承
例
この例では、 customErrors セクションのいくつかの属性に対して宣言によって値を指定する方法を示します。これは、 CustomErrorsSection クラスのメンバーとしてもアクセスできます。
次の構成ファイルの例は、 customErrors セクションに対して宣言によって値を指定する方法を示しています。
<customErrors mode="RemoteOnly"
defaultRedirect="customerror.htm">
<error statusCode="404" redirect="customerror404.htm"/>
</customErrors>
CustomErrorsSection クラスを使用する方法を示す例を次に示します。
// Get the Web application configuration.
System.Configuration.Configuration configuration =
WebConfigurationManager.OpenWebConfiguration(
"/aspnetTest");
// Get the section.
CustomErrorsSection customErrorsSection =
(CustomErrorsSection)configuration.GetSection(
"system.web/customErrors");
// Get the collection
CustomErrorCollection customErrorsCollection =
customErrorsSection.Errors;
' Get the Web application configuration.
Dim configuration _
As System.Configuration.Configuration = _
WebConfigurationManager.OpenWebConfiguration( _
"/aspnetTest")
' Get the section.
Dim customErrorsSection _
As CustomErrorsSection = _
CType(configuration.GetSection( _
"system.web/customErrors"), _
CustomErrorsSection)
' Get the collection
Dim customErrorsCollection _
As CustomErrorCollection = customErrorsSection.Errors
注釈
CustomErrorsSection クラスは、構成ファイルの customErrors セクションにプログラムでアクセスして変更する方法を提供します。 この型は、 CustomErrorCollection、 CustomErrorsMode、および CustomError 型を含むグループの一部です。
Note
CustomErrorsSectionは、値がAllowDefinitionセクション プロパティEverywhereに従って、構成ファイルの関連セクションとの間で情報の読み取りと書き込みを行うことができます。
コンストラクター
| 名前 | 説明 |
|---|---|
| CustomErrorsSection() |
既定の設定を使用して、 CustomErrorsSection クラスの新しいインスタンスを初期化します。 |