Home > Uncategorized > Prevent child web application to inherit web.config settings from root web application

Prevent child web application to inherit web.config settings from root web application

To prevent child web application to inherit settings from root web application, use the nifty inheritInChildApplication  attribute (new with 2.0) in your location section.  It’s a shame that this important property (or articles related to this) are not mentioned in the msdn help for <location> element.

more on this property:

J Ambrose Little

Brendan Kowitz’s .NET Blog

To quote Brendan..

"Most collections in the web.config have the <remove> tag or <clear> tag to remove irrelevant modules or handlers in the child app.  The problems I’ve found occur with settings relating to the <pages> tag, which most items in it don’t support <remove>. This means if your child applications doesn’t share or have the same registered controls, masterpages or themes then you are probably going to have issues or be forced to specify the settings on a per-page basis.  This is where the inheritInChildApplications="false" really comes in handy"

I have used this to isolate certain appSettings as well as <pages> section and is a life saver 🙂

Categories: Uncategorized
  1. No comments yet.
  1. No trackbacks yet.

Leave a comment