Click to Rate and Give Feedback
This page is specific to
Microsoft Visual Studio 2008/.NET Framework 3.5

Other versions are also available for the following:
.NET Framework General Reference
location Element (ASP.NET Settings Schema)

Specifies the resource that child configuration settings apply to and locks configuration settings, preventing the settings from being overridden by child configuration files.

This element is new in the .NET Framework version 2.0.

configuration Element (General Settings Schema)
  location Element (ASP.NET Settings Schema)
<location 
      allowOverride="True|False"
   path="path" 
/>

The following sections describe attributes, child elements, and parent elements for this element.

Attributes

Attribute

Description

allowOverride

Optional Boolean attribute.

Specifies whether configuration settings can be overridden by configuration settings that are in Web.config files that are in child directories.

The default is True.

path

Optional String attribute.

Specifies the resource that the contained configuration settings apply to. Using location with a missing path attribute applies the configuration settings to the current directory and all child directories. If location is used with no path attribute and allowOverride is False, configuration settings cannot be altered by Web.config files that are in child directories.

Child Elements

The location element can enclose other elements, either to apply configuration settings to a specific resource or to lock the configuration settings.

Parent Elements

Element

Description

configuration

Specifies the required root element in every configuration file that is used by the common language runtime and the .NET Framework applications.

The location element specifies the resource that child configuration settings apply to and is also used to lock configuration settings, preventing the settings from being overridden by child configuration files.

The location element can enclose other elements, either to apply configuration settings to a specific resource or to lock the settings. For more information, see Configuring Specific Files and Subdirectories and Locking Configuration Settings.

The following code example demonstrates how to allow an anonymous user to gain access the Logon.aspx page.

<configuration>
   <location path="Logon.aspx">
      <system.web>
         <authorization>
            <allow users="?"/>
         </authorization>
      </system.web>
   </location>
</configuration>

The following code example demonstrates how to set the uploaded file size limit to 128 KB for only the page specified.

<configuration>
  <location path="UploadPage.aspx">
    <system.web>
      <httpRuntime maxRequestLength="128"/>
    </system.web>
  </location>
</configuration>

The following code example demonstrates how to prevent configuration settings from being changed by Web.config files that are in child directories.

<configuration>
   <location allowOverride="false"/>
</configuration>

Configuration section handler

Does not apply.

Configuration member

ConfigurationLocation

Configurable locations

Machine.config

Root-level Web.config

Application-level Web.config

Virtual or physical directory–level Web.config

Requirements

Microsoft Internet Information Services (IIS) version 5.0, 5.1, or 6.0

The .NET Framework version 2.0

Microsoft Visual Studio 2003 or Visual Studio 2005

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Missing inheritInChildApplications attribute documentation?      Darkthread   |   Edit   |  
I found that there is no description about inheritInChildApplications attribute, which can stop inheritance between root web application and child web applcation.
Tags What's this?: Add a tag
Flag as ContentBug
Missing inheritInChildApplications attribute documentation...      Triynko   |   Edit   |  
Where is documentation for inheritInChildApplications? I have web applications in sub-folders of existing applications (ported from framework version 1), and I do not want to add a bunch of "remove" tags to override parent web.config settings.
Tags What's this?: Add a tag
Flag as ContentBug
Preventing inheritance      orioni   |   Edit   |  
The inheiritInChildApplications property seems to be half-supported: Visual Studio 2008's XSDs cause it to be marked as a warning, but ASP.NET seems to handle it fine and there is documentation for the property here: http://msdn.microsoft.com/en-us/library/system.configuration.sectioninformation.inheritinchildapplications.aspx

One other thing to watch out for is that VS 2008 can't detect when you place a <compilation debug="true"> inside the <location> element, so you'll get an incorrect "Debugging Not Enabled" dialog when you try to start debugging a web app. See (and vote for!) https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=293526


Tags What's this?: Add a tag
Flag as ContentBug
Processing
© 2008 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker