共用方式為


CustomErrorsSection.Errors 屬性

定義

取得 CustomError 物件的集合。

public:
 property System::Web::Configuration::CustomErrorCollection ^ Errors { System::Web::Configuration::CustomErrorCollection ^ get(); };
[System.Configuration.ConfigurationProperty("", IsDefaultCollection=true)]
public System.Web.Configuration.CustomErrorCollection Errors { get; }
[<System.Configuration.ConfigurationProperty("", IsDefaultCollection=true)>]
member this.Errors : System.Web.Configuration.CustomErrorCollection
Public ReadOnly Property Errors As CustomErrorCollection

屬性值

包含自訂錯誤的 CustomErrorCollection

屬性

範例

下列程式碼範例示範如何使用 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;
      ' 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

備註

每個錯誤都與自訂錯誤條件相關聯,並指定自訂錯誤頁面。

適用於