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
セクションにプログラムからアクセスして変更できます。 この型は、、CustomErrorsMode、および CustomError 型を含むグループのCustomErrorCollection一部です。
注意
はCustomErrorsSection、値Everywhereが である section プロパティAllowDefinitionに従って、構成ファイルの関連セクションとの間で情報の読み取りと書き込みを行うことができます。
コンストラクター
CustomErrorsSection() |
既定の設定を使用して CustomErrorsSection クラスの新しいインスタンスを初期化します。 |