Web.config

From Seo Wiki - Search Engine Optimization and Programming Languages

Jump to: navigation, search

Web.config is the main settings and configuration file for an ASP.NET web application. The file is an XML document that defines configuration information regarding the web application. The web.config file contains information that control module loading, security configuration, session state configuration, and application language and compilation settings. Web.config files can also contain application specific items such as database connection strings.

Contents

Example

<!-- This is an example Web.config file -->
<configuration>
    <system.web>
        <customErrors mode="Off"/>
    </system.web>
</configuration>

Inheritance

The initial web.config file for an application must be placed in the root directory of the web application. Sub-directories within the web application can contain their own web.config files to control individual configuration settings appropriate to the given sub-directory. ASP.Net uses a hierarchal configuration scheme that allows inheritance of configuration settings to minimize the actual web.config entries at a sub-directory.

Each web application in ASP.Net inherits their base web.config from the machine's web.config located in %SystemRoot%\WINDOWS\Microsoft.Net\Framework\v#.#.#.#\CONFIG, although individual sections can be assigned in the main web.config using the <location> directive and/or locked using the allowOverride element.[1]

Use in IIS 6 and IIS 7

In IIS 6, the directory that is the root of the web application needs to be configured as an Application via the Home Directory or Virtual Directory property tab in IIS Manager for the site.

IIS 7 does not have this requirement, making configuration of web applications significantly easier.

External links

ASP.NET Resources

References

  1. Locking Configuration Settings[1]
Personal tools

Served in 0.130 secs.