Hello Karch,
Not completely sure, but such behaviour shows that your 2 modules are loaded
when your common base code is initialized, because your modules are located
in the same dll
Why not to put your modules in different dlls? because now they serves as
the single module
---
WBR,
Michael Nemtsev [.NET/C# MVP] :: blog: http://spaces.live.com/laflour
"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo
K> I have an assembly which contains 2 HttpModule class that inherit
K> from a base class. The base class simply provides some common methods
K> - nothing special. The strange thing is that, even though I only
K> specify one or the other modules in the httpModules section, it seems
K> that both constructors are called. What is going on here? How do I
K> force it to only load the HttpModule that is indicated like so:
K>
K> If I want MyModule1 to be the "active" module, I specify this in the
K> web.config:
K>
K> <httpModules>
K> <add type="MyAssembly.MyModule1, MyAssembly" name="MyModule1"
K> />
K> </httpModules>
K> If I want MyModule2 to be the "active" module, I specify this in the
K> web.config:
K>
K> <httpModules>
K> <add type="MyAssembly.MyModule2, MyAssembly" name="MyModule2"
K> />
K> </httpModules>
K> What am I doing wrong? I keep getting runtime errors from the
K> MyModule1 constructor when I have specified the MyModule2 module (the
K> contructor for MyModule2 executes as well, by the way). I am using
K> .NET 2.0 Framework.
K>
K> Thanks,
K>
Karch - 12 Feb 2008 13:40 GMT
There is a business requirement that they be in the same assembly, and I
don't really see anything unreasonable about that. For exampe, assume I have
20 different modules and I want to deploy only 1 assembly to target
machines. Same thing here.
But, anyway, that's not the answer I was hoping for. The base code being
initialized should have nothing to do with it if I am specifying only one of
them. By the way, the base class, MyBaseModule implements IHttpModule and
then MyModule1 and MyModule2 inherit from MyBaseModule. So:
MyBaseModule : IHttpModule
MyModule1 : MyBaseModule
MyModule2 : MyBaseModule
Nevertheless, when I specify to load MyModule2, I can't see any reason that
MyModule1 would also be loaded.
> Hello Karch,
>
[quoted text clipped - 33 lines]
> K> K> Thanks,
> K> K