O'Reilly logo

Professional ASP.NET 3.5 Security, Membership, and Role Management with C# and VB by Stefan Schackow, Bilal Haidar

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

5.1. Using the <location /> Element

The <location /> element has existed since ASP.NET 1.0 as a convenient way to define configuration inheritance without the need to create and deploy multiple separate configuration files. Because web applications always have some type of hierarchy, and thus the concept of configuration inheritance, you commonly need to define configuration settings at different levels of the ASP.NET inheritance hierarchy. The following list shows the ASP.NET 3.5 inheritance chain:

  1. Settings defined in machine.config: In ASP.NET 2.0 many of the default ASP.NET settings have been moved out of machine.config to minimize startup time of non-web applications.

  2. Settings defined in the root web.config: This new configuration file exists in %windir%\Microsoft.NET\Framework\v2.0.50727\CONFIG. Most of the ASP.NET-specific default settings are now defined in the root web.config file.

  3. Settings defined in the web.config file located in the root folder of a website: For the default web site, this would be a folder resembling c:\inetpub\wwwroot.

  4. Settings defined in the root directory of the application: This is the web.config file that you normally work with in your applications. If the application is the website (meaning the application exists at "/"), the website configuration file and the application's configuration file are one and the same.

  5. Settings defined in a configuration file located in a subdirectory of a web application: Settings that can be changed on a per-directory ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required