CustomErrorsSection クラス
アセンブリ: System.Web (system.web.dll 内)


CustomErrorsSection クラスを使用すると、構成ファイルの customErrors セクションにプログラムからアクセスして変更できます。この型は、CustomErrorCollection 型、CustomErrorsMode 型、CustomError 型を含むグループの一部です。
![]() |
---|
CustomErrorsSection は、値が Everywhere のセクション プロパティ AllowDefinition に従って、構成ファイル内の関連するセクションから情報を読み込んだり、このセクションに情報を書き込んだりできます。 |

この例では、customErrors 要素 (ASP.NET 設定スキーマ) セクションの複数の属性に対して、宣言によって値を指定する方法を示しています。これらの属性には、CustomErrorsSection クラスのメンバとしてもアクセスできます。
次の構成ファイルの例では、customErrors セクションに対して、宣言によって値を指定する方法を示します。
<customErrors mode="RemoteOnly" defaultRedirect="customerror.htm"> <error statusCode="404" redirect="customerror404.htm"/> </customErrors>
CustomErrorsSection クラスを使用する方法を次のコード例に示します。
' 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
// 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;

System.Configuration.ConfigurationElement
System.Configuration.ConfigurationSection
System.Web.Configuration.CustomErrorsSection


Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


- CustomErrorsSection クラスのページへのリンク