views:

36

answers:

1

I have a WinSrv2k3 box with IIS6 hosting a series of sites, one of which is a VB/.NET2 site. Inside this I have created a virtual directory and pointed it at a very simple C#/.NET3.5 site's directory. I was expecting the site to allow me to view the pages as a normal site (there is only one ASMX in the virtual directory) but when accessing the page from a browser, I get:

Server Error in '/TestVbSite' Application.

Configuration Error

Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately. 

Parser Error Message: Could not load file or assembly 'IMSControls' or one of its dependencies. The system cannot find the file specified. (D:\sites\TestVbSite\web.config line 211)

Source Error: 


Line 209:    </httpHandlers>
Line 210:    <httpModules>
Line 211:      <add name="UrlRewritingModule" type="IMS.Controls.HttpModules.UrlRewritingModule, IMSControls" />
Line 212:    </httpModules>
Line 213:  </system.web>

Source File: D:\sites\TestVbSite\web.config    Line: 211

The issue I see there, is that the web.config throwing the exception appears to be the parent web site's .config, not the web.config in the virtual directory. But I don't understand why.

When accessing regular pages within the website (not under the virtual directory) they render and perform as normal, indicating that the IMSControls DLL is unable to load from the virtual directory, but again, I don't understand why this would even be involved in the process.

A: 

Ok, well, after some false starts, heavy googling gave me the correct thing to look for: web.config inheritance.

Basically, to stop a virtual directory from inheriting the attributes of it's parent site's web.config (and therefore any problems from it) the parent site's web.config needs to have its <system.web> element wrapped in a new (to me) tag:

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

Useful links:

http://forums.asp.net/t/1164283.aspx

http://dotnetslackers.com/Security/re-55457_Stopping_ASP_NET_web_config_inheritance.aspx

http://msdn.microsoft.com/en-us/library/ms178685.aspx

Matt W