Web Configuration Files

Web Configuration file hierarchy

Configuration files allow management of settings related to website, e.g. security info, database connection strings, cache settings, etc.

Site may use multiple configuration files, based on a hierarchy.

location file
Global config %SystemRoot%Microsoft.NETFrameworkCONFIGMachine.config
Root web config   %SystemRoot%Microsoft.NETFrameworkCONFIGWeb.config
Website <www root>\Web.config
Web application <www root>\<web app>\Web.config
Folder <www root>\<web app>\<dir>\Web.config

 

When initially run ASP.NET application the runtime environment builds a cache of configuration settings by flattening the layers of configuration files.

.NET 4 Configuration Files

Previous versions of .NET used same configuration file. As framework evolved the configuration file has got longer and more unwieldy.

.NET 4 has new CLR and a new Machine.config file that includes many of the settings previously added to individual Web.config files - makes them much shorter.

Editing Configuration Files

Can use any text editor.

Visual Studio 2010 provides Web Site Administration Tool (WSAT) that can modify configuration file settings in following categories:

  • Security - manage users and their permissions
  • Application configuration - modify application specific settings that function as application-wide constants.
  • Provider configuration - specify database settings for maintaining membership and role settings

WSAT allows creation and modification of settings that are not inherited. Inherited settings that cannot be overridden are unavailable.

IIS 7.5 Manager allows editing of many common ASP.NET configuration settings.

Download