This documentation is archived and is not being maintained.

<location> Element

Specifies the resource that specified configuration settings apply to.



<location path="path" 

Optional Attributes

Attribute Option Description
path   The resource that the specified 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 specified to be false, configuration settings cannot be altered by Web.config files in child directories.
allowOverride   Specifies whether configuration settings can be overridden by configuration settings in Web.config files in child directories.
  true Specifies that configuration settings can be overridden. The default is true.
  false Specifies that configuration settings cannot be overridden.


The following example allows an anonymous user to access the Logon.aspx page.

   <location path="Logon.aspx">
            <allow users="?"/>

The following example sets the uploaded file size limit to 128KB for only the page specified.

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

The following example prevents configuration settings from being changed by Web.config files in child directories.

   <location allowOverride="false"/>


Web Platform: IIS 5.0, IIS 5.1, IIS 6.0

Configuration File: Machine.config, Web.config

See Also

ASP.NET Configuration | ASP.NET Settings Schema