Mar 31
VN:F [1.6.7_924]
Rating: 7.0/7 (1 vote cast)

Asp.net configuration file, web.config (machine.config at server level)  applies to the directory in which it appears and all sub – directories. The configuration file hierarchy for a Asp.net site goes as shown below.

Asp.net Configuration File Hierarchy

Here is a link where you can read more about web.config inheritance. While settings are inherited from the higher level of configuration file, child configuration files are always permitted to override them. Inheritance downward is useful for applying a unique settings for all applications on server but in certain situation a higher config file may want to prevent inheritance in child applications. This can be achieved by using the <location> element as follows.

<location path="." inheritInChildApplications="false">
<system.web>
...
...
</system.web>
</location>

The above code can prevent inheriting the <system.web> element in this case, into the child web application. Please note that this piece of code should be placed in the parent’s web.config file.

Tagged with:
preload preload preload