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

Page 1 of 4 Next Page >

Introduction

ASP+ configuration information is stored in XML-based configuration files. Using built-in features of IIS 5.0 and IE 5.0 such as the FileSystemObject, the XML Document Object Model (DOM) and XML Data Islands, we can easily develop a rich tool for modifying and editing these configuration files. In this three part lesson we will build a web based tool for loading, modifying, and saving the ASP+ config.web configuration file.

In part one (this lesson) we will discuss the contents and structure of the config.web file, then build an ASP+ file for loading the config.web file into a client side DOM object (data island). Part two will feature data-binding the XML DOM object to client intrinsic controls, providing a rich editing environment. Finally, in part three we will post the XML data back to the server and save the new config.web file back to the ASP+ application.

Note: ASP+, config.web, and many other items in this discussion are part of Microsoft's .NET framework, which is still in development and subject to change. Information for these articles has been obtained from preliminary documentation, also subject to change, and from hands on experience working with the .NET framework SDK technology preview.

To run the samples included with this lesson you will need to install the .NET Framework Technology Preview. Visit http://msdn.microsoft.com/net/ for more information.

Welcome to config.web

ASP developers are used to using global configuration files in the form of global.asa and other home built files. ASP+ adds on to this concept of global configuration by providing a true configuration file in the config.web file. Rather than being a global event handler for handling state configuration, the config.web file is a real configuration file for storing system and application settings independent of state.

The config.web file is XML-based, which means that it inherits all of the wonderful features that are the nature of XML files, such as being human-readable and human-writeable, as well as being customizable (extensible). This feature of being extensible means that in addition to storing all of the system configuration items, you can add your own configuration criteria and settings within the configuration system.

Following is an example of a config.web file:


<!-- CONFIG.WEB FILE -->
<configuration>
   <configsections>
      <add names="httpmodules" type="System.Web.Config.HttpModulesConfigHandler"/>
      <add names="httphandlers" type="System.Web.Config.HttpHandlerConfigHandler"/>
      <add names="sessionstate" type="System.Web.Config.SessionStateConfigHandler"/>
      <add names="globalization" type="System.Web.Config.GlobalizationConfigHandler"/>
      <!-- ADDITIONAL CONFIGSECTION DECLARATIONS GO HERE -->
     </configsections>

   <httpmodules>
      <!-- http module subelements go here -->
   </httpmodules>

   <httphandlers>
      <!-- http handlers subelements go here -->
   </httphandlers>

   <sessionstate>
      <!-- session state subelements go here -->
   </sessionstate>

   <globalization>
      <!-- session state subelements go here -->
   </globalization>

   <!-- ADDITIONAL CONFIG SECTIONS GO HERE -->

</configuration>

Notice that all configuration information must reside between the <configuration> and </configuration> tags. The file is made up of two main parts. The first part is the <configsections> section which specifies the configuration section handler declarations. The remainder of the file contains the actual configuration sections, as specified in the <configsections> part. The configuration section handler declarations specify the name of each configuration section, and the .NET assembly and class that will handle that configuration information. For Example:


<configuration>

   <configsections>
      <add name="debugmode" type="System.Web.Config.SingleTagSectionHandler" /> 
      <add name="globalization" type="System.Web.Config.SingleTagSectionHandler" />
      <add name="assemblies" type="System.Web.UI.AssembliesSectionHandler" />
      <add name="security" type="System.Web.Config.SecurityConfigHandler" />
   </configsections>

   <debugmode enable="true" />

   <globalization
      requestencoding="us-ascii"
      responseencoding="iso-8859-1"
   />

   <assemblies>
      <add assembly="System.Data.dll"/>
      <add assembly="System.dll"/>
      <add assembly="System.Drawing.dll"/>
      <add assembly="*"/>
   </assemblies>

   <security>
      <authorization>
         <allow users="*" />
      </authorization>
   </security>
 
</configuration>

The above example demonstrates the use of four configuration sections.


Page 1 of 4 Next Page >

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

Jump to : Top Of Page or HOME