Tuesday, March 6, 2012

ASP.NET Configuration Files

ASP.NET configuration data is stored in XML text files, each named Web.config. Web.config files can appear in multiple directories in ASP.NET applications. If you have Microsoft SharePoint installed, you can check it by observing folders in the following directory, "C:\inetpub\wwwroot\wss\VirtualDirectories".

Each Web.config file applies configuration settings to its own directory and to all the child directories below it. Settings in child directories can optionally override or modify settings that are specified by the parent directories. Apart from that additional Web.config files can be located in a Web site's subfolders to provide overrides that apply specifically to those folders within that site.

The root of the ASP.NET configuration hierarchy is the , "C:\Windows\Microsoft.NET\Framework\VersionNumber\Config\Web.config" file, which includes settings that apply to all ASP.NET applications that run a specific version of the Microsoft .NET Framework. Since each ASP.NET application that you will create will inherit from default configuration settings from the root Web.config file, you only need to create Web.config files for settings that will override the default settings.

There are number of important settings that can be stored in the configuration file. Here are some of the most frequently used configurations, stored conveniently inside Web.config file.
  • Database connectivity information
  • Session state information
  • Error Handling
  • Security

Happy Coding.

Regards,
Jaliya