Block Inheritance of Root web.config for Child Applications

10. January 2008

I ran across a situation working on an Intranet application where I did not want a sub directory (which was a seperate web application) to inherit the parent/root web applications web.config settings.  I searched around and found an article about the lock attributes for sections and elements in the web.config, but that was not working.  Basically what was happening is that when I went to the sub application via http://mainsite/subApp the subApp would fail because it said it couldn't find a reference to a setting I had in my root applications web.config (in my case it was a tagMapping and HttpModule settings).

The following takes care of this type of situation.

In the root web.config file I wrapped my <system.web> section with the following tags:

<location path="." inheritInChildApplications="false">
    <system.web></system.web>
</location>

This allows all child applications to use its web.config only and not worry about anything in the parents web.config.  The following URL is an MSDN article about it:

http://msdn2.microsoft.com/en-us/library/system.configuration.sectioninformation.inheritinchildapplications.aspx

Digg It!DZone It!StumbleUponTechnoratiRedditDel.icio.usNewsVineFurlBlinkList

ASP.NET ,

Comments

steven
8/6/2008 7:26:02 PM #
this was perfect.
John_M
8/7/2008 1:26:53 AM #
Glad this worked out for you Steven!

John_M (author)
7/23/2009 5:33:59 AM #
Trackback from xBlog

Blocking web.config inheritance
3/20/2010 1:51:44 AM #
Pretty insightful post. Never thought that it was this simple after all. I had spent a good deal of my time looking for someone to explain this subject clearly and you’re the only one that ever did that. Kudos to you! Keep it up
3/20/2010 7:15:16 PM #
It does seem that everybody is into this kind of stuff lately. Don’t really understand it though, but thanks for trying to explain it. Appreciate you shedding light into this matter. Keep it up

Add comment




  Country flag

biuquote
  • Comment
  • Preview
Loading