views:

206

answers:

1

I'd like to have the functionality of merging/inheriting the web.config of one site with that of a shared web.config, but without having the site being a child site of the site with the shared web.config.

Is there a way to implement similar functionality?

What I'm trying to do have a shared web.config in any folder (could be outside of wwwroot). Then multiple sites under IIS will have their own web.configs which merge/inherit with the shared web.config. The aim is to have the site web.configs as non-cluttered as possible, maybe just app settings for company id and a reply email address.

+2  A: 

I would use the machine.config for the shared stuff.

Or you can reference the shared web.config like this:

<appSettings file="../Support/config/WebEnvironment.config">
</appSettings>

And here I blog about when we moved all of our settings to a database table.

JBrooks
Putting it into machine.config means it will apply to all my sites which is not what I want. I want to include selectively. Also, using a reference in appSettings will only fix the appSettings section. The other parts like compilation, authorization, etc should also be taken from the shared config.
fung