Home > ASP.NET Applications > ASP.NET Configuration > Hierarchical Configuration Architecture > Limiting Inheritance with <Location> Settings
ASP.NET Web Applications ASP.NET Configuration Hierarchical Configuration Architecture
Configuration settings can be applied to specific resources by using a <location> tag with an appropriate path attribute. The path attribute can be used to identify a specific file or child directory to which unique configuration settings apply.
For example, the following configuration file specifies settings at three levels:
- Settings that apply to the current directory and all child directories ( everything contained within the top <configuration> tag )
- Settings that apply to the
sub1
child directory ( everything contained within the <location> tag with a path attribute set to sub1
)
- Settings that apply to the
sub2
child directory ( everything contained within the <location> tag with a path attribute set to sub2
)
<configuration>
<system.web>
<sessionState cookieless = "true" timeout = "10"
server = "localhost" port = "42424" />
</system.web>
<!-- Configuration for the "Sub1" subdirectory -->
<location path = "sub1">
<system.web>
<httpHandlers>
<add verb = "*" path = "Sub1.Scott" type = "Sub1.Scott" />
<add verb = "*" path = "Sub1.David" type = "Sub1.David" />
</httpHandlers>
</system.web>
</location>
<!-- Configuration for the "Sub2" subdirectory -->
<location path = "sub2">
<system.web>
<httpHandlers>
<add verb = "*" path = "Sub2.Scott" type = "Sub2.Scott" />
<add verb = "*" path = "Sub2.David" type = "Sub2.David" />
</httpHandlers>
</system.web>
</location>
</configuration>
ASP.NET Configuration Sections Configuration Inheritance Locking Configuration Settings