CustomErrorCollection Class
Represents a collection of CustomError objects. This class cannot be inherited.
Assembly: System.Web (in System.Web.dll)
The CustomErrorCollection type allows access to the error elements of the customErrors section element collection.
It belongs to a group that includes the CustomError, CustomErrorsMode, and CustomErrorsSection.
This example demonstrates how to specify values declaratively for the error elements of the customErrors section, which can also be accessed as elements of the CustomErrorCollection collection.
The following configuration file example shows how to specify values declaratively for the error elements.
<customErrors mode="RemoteOnly"
defaultRedirect="customerror.htm">
<error statusCode="404" redirect="customerror404.htm"/>
</customErrors>
The following code example demonstrates how to use the CustomErrorCollection class.
' 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
System.Configuration.ConfigurationElement
System.Configuration.ConfigurationElementCollection
System.Web.Configuration.CustomErrorCollection
Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.