The Darkside

Shedding light on things and stuff

 
  Home :: Contact :: Syndication  :: Login
  75 Posts :: 0 Stories :: 49 Comments :: 2 Trackbacks

Ads

Archives

Post Categories

Open Source Projects

Other Blogs

I came across a problem when a virtual directoy I had created inherited the setting from my web config file in the parent directory. I was always aware of this, and had used it to great effect, however, in this case, the parent site had all sorts of http modules/handlers and page directives included, and I really didn't want to (a) copy all of the bin files across just to make it work, or (b) add a whole bunch of <remove /> tags to the various sections just to take them out.

After a bit of trial-and-error typing, I came across the <location> tag which allows you to specify a path that the configuration appplies to, as well as whether or not the configuration can be overridden. This tag should open and close just before and after the System.Web tag. 

<location path="." allowOverride="true">

  <system.web>

    <!-- System.Web stuff -->

  </system.web>

</location>

After some Googling, I found that you could also add another keword, "inheritInChildApplications", to the tag, and set it to false.

<location path="." allowOverride="true" inheritInChildApplicaions="false">

 I noticed the VS2008 wasn't happy about the keyword, but it seemed to work in any case. Some searching in the MSDN documentation revealed that this property is available on the SectionInformation class and "Gets or sets a value that indicates whether the settings that are specified in the associated configuration section are inherited by applications that reside in a subdirectory of the relevant application."

It works. The virtual directory doesn't inherit any of the parent application settings.

posted on Tuesday, September 02, 2008 12:00 AM
Comments have been closed on this topic.