Asp.NET subfolder applications, web.config in root interferes with application

Posted by craig Monday, May 04, 2009 11:46:05 AM

 

When hosting applications in subfolders in ASP.NET a problem which can arise is conflicts between the web.config in the root and the web.config in the subfolder.  Conflict can mean any number of things, in my case, this sub-application was trying to load DLLs which had nothing to do with the sub-application, but were referenced in the root application.  The Dlls were not in the bin folder of the sub-application which led to errors.

Solution:  inheritInChildApplications="false"

The solution to the problem is  a little known attribute inheritInChildApplications="false".  Setting the value to false in the root web.config file means that subapplications will run independently of the root application.

This attribute can be used in the location tag as follows:

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

</system.web></location>

NOTE:  Visual Studio 2008 does not seem to recognize the attribute in the editor, it underlines it as if the attribute is not supported, however this is a problem with the xsd.  The tag definitely works!

I also ran into strange circular redirect problems, because of incompatibilities in the root and subapplications.  Problem probably came from circular redirections from use of URL rewriting.

Copyright 2009 AnyTime
Comments are closed on this post.