web.config inheritance, problems in subfolders

Posted by craig Monday, December 26, 2011 3:50:00 PM

A common problem encountered with websites being hosted externally is that we often want to use subfolders to host other applications.  However the web.config is inherited by default which can cause unexpected side effects.  Typically certain assemblies will be missing because the parent level bin directly is not accessible in the cild application subfolder.  However these DLLs in many cases are not needed by the child applications.  In order to overcome this problem  we need to disable the inheritance in the root application.

 

This can be done as follows:

<location path="." InheritInChildApplications="false">
<system.web>...</system.web>
</location> We wrap the system.web element in a location element and add the key attribute
InheritInChildApplications="false" .
Note that this must also be done for the system.webserver element :  <location path="." inheritInChildApplications="false">

<system.webServer>
... In my particular case, for Mojoportal, I needed to add both.

Copyright 2009 AnyTime