Advertise Here
XML Files - Extensible Markup Language Tutorials for Developers - ?
Extensible Markup Language

Search XML Files

XML Files RSS Feed XML Files Updates

 


Using XML to build an ASP+ config.web Editor

By
Adam S. Cartwright

< Previous Page Page 2 of 4 Next Page >

ASP+ Standard Section Handlers

ASP+ ships with several standard section handlers that can be used to process configuration settings within config.web files. The .NET SDK documents each of these standard section handlers in detail with sample code to demonstrate proper syntax. The following is a summary of these standard section handlers:

  • <browsecaps> : Configures the settings for the browser capabilities component.
  • <compilation> : Contains all the compilation settings.
  • <configuration> : Root configuration section for all ASP+ configuration files.
  • <configsections> : Contains a list that indicates the configuration section handlers associated with each configuration section.
  • <globalization> : Configures the globalization settings of the application.
  • <httphandlerfactories> : Maps incoming URL requests to IHttpHandlerFactories.
  • <httphandlers> : Maps incoming URL requests to IHttpHandler classes.
  • <httpmodules> : Adds, removes or clears Http Modules within an application.
  • <processmodel> : Configures the ASP+ process model settings on IIS Web Server systems.
  • <security> : Configures all security settings used by ASP+.
  • <sessionstate> : Configures the session state HttpModule.
  • <tracing> : Configures the ASP+ trace service.

Custom Configuration Settings

As I stated above, it is possible to extend the configuration file with your own configuration settings. To do so, all you have to do is create your own Configuration Section Handler, which must be a class that implements the System.Web.Config.IConfigSectionHandler interface.

The IConfigSectionHandler interface is defined as follows:

namespace System.Web.Config
{
   public interface IConfigSectionHandler
   {
      public Object Create(Object parent, 
                           ConfigInput[] input, 
                           String path);
   }
}

For more information on how to add custom configuration settings, see the .NET Framework SDK.

Accessing Configuration Settings

Accessing the configuration settings found in the config.web file is extremely simple and quite straight forward. One thing to remember is that the configuration settings are hierarchical, thus it is possible to have configuration files for specific URLs.

Accessing the configuration settings is accomplished by using the GetConfig() method exposed on the HttpContext object. For example:


SessionStateConfig config = (SessionStateConfig)
                             Context.GetConfig("sessionstate");

if (config.CookieLess == true)  {
   // Cookieless sessions are activatedů
}

if (config.InProc == true) {
   // InProc session state is being usedů.
}

The above example shows how to access configuration information for the current URL being processed. To access configuration information for a specific URL, use the following example:


SessionStateConfig config = (SessionStateConfig)
                   Context.GetConfig("sessionstate", "/MyDir/MyApp.aspx");

if (config.CookieLess == true)  {
   // Cookieless sessions are activatedů
}

if (config.InProc == true) {
   // InProc session state is being usedů.
}

< Previous Page Page 2 of 4 Next Page >

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 DevX XML Content 
- Easily Create Responsive Websites Using Bootstrap

Jump to : Top Of Page or HOME