ASP.NET Syntax ASP.NET Configuration Sections
.NET Framework version 2.0
Specifies the resource that child configuration settings apply to and locks configuration settings, preventing the settings from being overridden by child configuration files.
<location
allowOverride = "true | false"
path = "path" />
The following sections describe attributes, child elements, and parent elements for this element.
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. |
The location element can enclose other elements, either to apply configuration settings to a specific resource or to lock the configuration settings.
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 Locking Configuration Settings.
The following code example demonstrates how to allow an anonymous user to gain access to 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">
<httpRuntime maxRequestLength = "128" />
</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>
ASP.NET Configuration Configuration <location> Settings Locking Configuration Settings