I have an ASP.NET application that defines a custom configuration section in web.config.
Recently I had a customer who wanted to deploy two instances of the application (for testing in addition to an existing production application).
The configuration chosen by the customer was:
- foo.com - production application
- foo.com/Testing - test application
In this case, the ASP.NET configuration engine decided to apply the settings at foo.com/web.config to foo.com/Testing/web.config.
Thankfully this caused a configuration error because the section was redefined at the second level rather than giving the false impression that the two web applications were isolated.
What I would like to do is to specify that my configuration section is not inherited and must be re-defined for any web application that requires it but I haven't been able to find a way to do this.
My web.config ends up something like this
<configuration>
<configSections>
<section name="MyApp" type="MyApp.ConfigurationSection"/>
</configSections>
<MyApp setting="value" />
<NestedSettingCollection>
<Item key="SomeKey" value="SomeValue" />
<Item key="SomeOtherKey" value="SomeOtherValue" />
</NestedSettingCollection>
</MyApp>
</configuration>