asp.net.ph

CustomErrorsSection Class

System.Web.Configuration Namespace


.NET Framework version 2.0

Configures custom error handling for a Web application. This class cannot be inherited.

CustomErrorsSection Class Members

Collapse   Constructors

Visibility Constructor Parameters
public CustomErrorsSection ( )

Collapse   Properties

Visibility Name Value Type Accessibility
public AllowNestedErrors Boolean [ Get , Set ]
public DefaultRedirect String [ Get , Set ]
public Errors CustomErrorCollection [ Get ]
public Mode CustomErrorsMode [ Get , Set ]
public RedirectMode CustomErrorsRedirectMode [ Get , Set ]

Collapse   Methods

Visibility Name Parameters Return Type
protected DeserializeSection ( XmlReader reader ) Void
protected Reset ( ConfigurationElement parentElement ) Void

Remarks

The CustomErrorsSection class provides a way to programmatically access and modify the customErrors section of a configuration file.

This type is part of a group that includes the CustomError, CustomErrorCollection, and CustomErrorsMode types.

NOTE: The CustomErrorsSection can read and write information from and to the related section of the configuration file according to the section property AllowDefinition whose value is Everywhere.

Example

This example demonstrates how to specify values declaratively for several attributes of the customErrors section, which can also be accessed as members of the CustomErrorsSection class.

The following configuration file example shows how to specify values declaratively for the customErrors section.

<customErrors mode = "RemoteOnly"
   defaultRedirect = "customerror.htm">
   <error statusCode = "404" redirect = "customerror404.htm" />
</customErrors>

The following code example demonstrates how to use the CustomErrorsSection class.

// 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;
  C# VB

See Also

ASP.NET Configuration   <customErrors> Section   CustomErrorsMode Enumeration Skip Navigation Links




Home
Suggested Reading


Previous page Back to top Next page

© 2000-2010 Rey Nuñez All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note

You can help support asp.net.ph