INFO: ASP.NET Configuration Overview

This article refers to the following Microsoft .NET Framework Class Library namespace:

  • System.Configuration


This article provides an introduction to the ASP.NET page framework.

For additional ASP.NET overviews, refer to the following Microsoft Knowledge Base article:

305140 INFO: ASP.NET Roadmap

More Information

Configuration involves everything from application settings such as database connections to security details and information about how errors should be handled. Configuration files provide a location for computer-specific and application-specific information that you can change without having to recompile code.

This article addresses the following configuration topics:

Configuration: What's New

In contrast to Active Server Pages (ASP) application settings that are stored in the Microsoft Internet Information Services (IIS) metabase, ASP.NET configuration settings are stored in Extensible Markup Language (XML) files. This provides the following advantages when you need to change configuration settings and deploy applications:

  • ASP.NET configuration files are stored in the same directory as the site content. At deployment time, you only need to copy the content directory to obtain both the content and the application configuration.

  • You can use standard text editors to modify configuration files. This makes it easy to change configuration settings both locally and remotely.

  • The configuration files are extensible; as a result, you can add your own custom configuration settings.

  • The system automatically detects changes to ASP.NET configuration files. You do not have to restart IIS or reboot the Web server for the settings to take effect.

File Format and Configuration Hierarchy

There are two types of configuration files with which you should be concerned for ASP.NET applications: Machine.config and Web.config. Both files are XML-based and contain similar configuration sections. However, the Machine.config file contains configuration information about all .NET applications for a specific version of the framework, whereas the Web.config files contain more granular configuration settings about specific ASP.NET applications. The text in Machine.config and Web.config is case-sensitive.

For more information about the format of ASP.NET configuration files, refer to the following topic in the .NET Framework Software Development Kit (SDK) documentation:

Format of ASP.NET Configuration Files When a request for an .aspx page is made, the configuration files are compiled in such a way that a configuration setting in a Web.config file that is stored in a subdirectory overrides a setting in a Web.config file in an application directory, which overrides settings on the Web site level and settings in the Machine.config file. After the configuration settings are compiled, they are cached for future requests until one of the configuration files is modified.

The following table lists sample configuration file locations for the http://myserver/myapplication/mydir/mypage.aspx URL:



Configuration settings for this version of the .NET Framework


Web site settings


Application settings


Subdirectory settings


A Web.config file at any level is optional, but a Machine.config file is required.

For more information about configuration hierarchy, refer to the following topic in the .NET Framework SDK documentation:

Hierarchical Configuration Architecture To apply configuration settings to specific resources, use a <location> tag with an appropriate path attribute. You can use the path attribute to identify a specific file or child directory to which unique configuration settings apply.

For more information about the <location> tag, refer to the following topic in the .NET Framework SDK documentation:

Configuration <Location> Settings

ASP.NET Configuration Sections

The ASP.NET configuration sections are contained in the <system.web> section, which is contained in the <configuration> tag:


The following table lists all of the ASP.NET configuration sections:



Configures custom settings for an application. The settings in this section can be compared to application variables.

Configures the authentication mode to determine which type of authentication to use.

Configures authorization support and controls client access to URL resources.

Configures the settings of the browser capabilities component.

Configures all the compilation settings that ASP.NET uses.

Provides information about custom error messages for an ASP.NET application.

Configures the globalization settings for the application.

Maps incoming URL requests to the IHttpHandler classes.

Adds, removes, or clears HTTP modules within an application.

Configures ASP.NET HTTP run-time settings.

Controls the application identity of the Web application.

Configures keys to use for encryption and decryption of Forms authentication cookie data. This section allows you to configure a validation key that performs message authentication checks on view state data and forms authentication tickets.

Identifies page-specific configuration settings.

Configures the ASP.NET process model settings on IIS Web server systems. Note that you can only use this tag in the Machine.config file.

Defines valid mappings of named security levels to policy files.

Configures the session state module.

Configures the ASP.NET trace service.

Configures the set of code access security permissions that is used to run a particular application.

Controls the settings of ASP.NET Web Services.

Need more help?

Expand your skills
Explore Training
Get new features first
Join Microsoft Insiders

Was this information helpful?

Thank you for your feedback!

Thank you for your feedback! It sounds like it might be helpful to connect you to one of our Office support agents.