CustomErrorsSection.Errors 属性
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取 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
注解
每个错误都与自定义错误条件相关联,并指定自定义错误页。