views:

1172

answers:

3

Hi

I setup a IIS application from within an existing application.

Will the parents web.config be inherited or is that something I have to set explicitly?

A: 

Yes it will without setting anything explicitly, and I don't know any way to prevent it.

However many configuration sections will allow you to clear data inherited from parent files.

E.g.

<appSettings>
   <clear/>
   <add key=...>
</appSettings>

<connectionStrings>
   <clear/>
   <add ... />
</connectionStrings>
Joe
how can I make it ignore?
Blankman
You can only do it by creating the application in another directory, or change the settings back.
Nick Berardi
A: 

the child inherits the parent's web.config.

also, when a new web.config is created in the child, the child's web.config settings override the same settings in the parent's web.config.

Dana
+1  A: 

You can also use the Remove tag to get rid of things you don't want or put everything in a location and tell it not to inherit.

 <remove name="FooBar" />

<location path="." inheritInChildApplications="false">
    <system.web>
    ...
    </system.web>   
  </location>
Chuck
but what about the sections outside of system.web? like <system.webServer>
Blankman
not 100% sure, but I believe you can wrap anything in a "location". I haven't tried, would definitely need to test it.
Chuck
Elements that are only allowed in "root" web.configs can't be wrapped in a "location".
Zhaph - Ben Duguid