CustomErrorsSection.Errors Property

 

Gets the collection of the CustomError objects.

Namespace:   System.Web.Configuration
Assembly:  System.Web (in System.Web.dll)

[ConfigurationPropertyAttribute("", IsDefaultCollection = true)]
public CustomErrorCollection Errors { get; }

Property Value

Type: System.Web.Configuration.CustomErrorCollection

A CustomErrorCollection that contains the custom errors.

Each error is associated with a custom error condition and specifies a custom error page.

The following code example shows how to use the Errors collection.


// 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;

.NET Framework
Available since 2.0
Return to top
Show: