Home All Groups Group Topic Archive Search About

iHttpModule and Virtual Directories

Author
14 Apr 2005 3:22 PM
SirPyros
I am working on a web application, for which i created a custom
ihttpmodule to handle authentication. I am creating another application
in a virtual directory under this one. But when I try to run it i get
the following 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: File or assembly name Security, or one of its
dependencies, was not found.

Source Error:


Line 92:
Line 93:     <httpModules>
Line 94:         <add name="AuthenticationModule"
type="Security.AuthenticationModule, Security" />
Line 95:     </httpModules>
Line 96:     <httpHandlers>


Source File: c:\inetpub\wwwroot\web.config    Line: 94

The error is coming from the web.config file from the root application,
but the application in the virtual directory has its own web.config. I
made sure that the directory was set as an application in IIS. Anyone
know how I can stop the application in the lower level from trying to
load the module from the root application?

Author
15 Apr 2005 4:36 AM
Adam Goossens
Hi,

This question would probably be better asked in the ASP.NET newsgroup
since it doesn't really have anything to do with VB.NET coding. But,
I'll help you out as best I can anyway :)

As far as I know there is no way to prevent this (Web.config settings
stack as you go down the directory hierarchy).

In an attempt to mitigate it, however, you can use the <clear /> element
in your <httpModules> section to remove all the HttpModules that your
parent directories have loaded:

---
<httpModules>
     <clear />
<httpModules>
---

There is also the <remove> element to remove individual types. Check out
the documentation on "httpModules element" in the Framework SDK.

Regards,
-Adam.

SirPyros wrote:
Show quoteHide quote
> I am working on a web application, for which i created a custom
> ihttpmodule to handle authentication. I am creating another application
> in a virtual directory under this one. But when I try to run it i get
> the following 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: File or assembly name Security, or one of its
> dependencies, was not found.
>
> Source Error:
>
>
> Line 92:
> Line 93:     <httpModules>
> Line 94:         <add name="AuthenticationModule"
> type="Security.AuthenticationModule, Security" />
> Line 95:     </httpModules>
> Line 96:     <httpHandlers>
>
>
> Source File: c:\inetpub\wwwroot\web.config    Line: 94
>
> The error is coming from the web.config file from the root application,
> but the application in the virtual directory has its own web.config. I
> made sure that the directory was set as an application in IIS. Anyone
> know how I can stop the application in the lower level from trying to
> load the module from the root application?
>