g45rg34d
g45rg34d

Reputation: 9660

What is <location path="web.config"> for?

What is the meaning of:

<location path="web.config">

With the following web.config file (located in the root of the web app) will doDynamicCompression be set to true or false?

<configuration>
    <system.webServer>
        <urlCompression doDynamicCompression="true" />
    </system.webServer>

    ...

    <location path="web.config">
        <system.webServer>
            <urlCompression doDynamicCompression="false" />
        </system.webServer>
    </location>
</configuration>

Upvotes: 3

Views: 4042

Answers (2)

Branislav Abadjimarinov
Branislav Abadjimarinov

Reputation: 5131

Location tag is used to apply settings to a given file or path from a web.config file. Alternatively you can put a web.config file in a directory and put your settings there. Both ways you'll override the settings from the web.config in your root directory or the machine.config. ASP.NET is configured not to server .config files so in your case this configuration is unusable.

Upvotes: 1

Nick Craver
Nick Craver

Reputation: 630389

This:

<location path="web.config">

Represents special settings for that path or file, overriding settings for the root and below, which is what all your settings without a location tag do. web.config is never served anyway...so dynamic compression will be enabled in your example.

Upvotes: 2

Related Questions