Web.config – Basic Sections

In Visual studio 2003 web.config is getting created automatically when you create an ASP.NET Web Application project. Whereas in Visual studio 2005 web.config file is not getting created on creation of website project but when we are trying to build the website then it will ask us to enable the debugging if we select “YES” then Web.config file is getting created. The Web.config file is created in the application’s root directory and contains the settings specific to an individual application therefore, also called the application-level configuration file.Web.config file is a XML file with specific tags having specific meanings, we can also specify custom Tags in Web.config file.

The Web.config file inherits settings from the machine.config file. .NET Framework installs with predefined configuration sections in the Machine.config file. These built-in sections provide the default configuration settings and almost all the functionalities needed to configure most ASP.NET applications. Developers can either use the default settings, or specify settings for any or all of the configuration sections in any of the application’s Web.config files. Developers can also create custom configuration sections.

In Web.config <configuration> is the required root element used by CLR & .Net Framework

Default Web.config created will look as follows.

<configuration xmlns=”http://schemas.microsoft.com/.NetConfiguration/v2.0″&gt;




<compilation debug=”true”/>

<authentication mode=”Windows”/>



So here we can find <configuration> Section is having xmlns attribute and other 5 main elements

Xmlns – “http://schemas.microsoft.com/.NetConfiguration/v2.0&#8221; – Specifies the URL to the XML schema that is used to validate the configuration file. If this attribute is not set, you cannot use F1 Help in Microsoft Visual Studio to open topics for the configuration elements.

Elements –

configSections – Specifies configuration section and namespace declarations.

appSettings –  Contains custom application settings, such as file paths,

XML Web service  URLs, or any information that is stored in the

.ini file for an  application.

connectionStrings – Specifies a collection of database connection strings,

as name/value pairs, for ASP.NET applications and features.

location –    Specifies the resource that child configuration settings apply to.

This element is also locks configuration settings,

which prevents the settings from being overridden by child configuration files.

system.web – Specifies the root element for the ASP.NET configuration section and

Contains configuration elements that configure ASP.NET

Web applications and control how the applications behave.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s