I've done HttpModules in separate assemblies and don't remember integration being too tricky. But when I was just writing one within the App_Code of the same site I was having all sorts of issues. I think I found some common gotchas related to HttpModules.
First, my module was not loading but I didn't even get an error page. I was able to get useful errors by switching the App Pool of the site to "Classic .NET AppPool" from the "DefaultAppPool". Turns out this did more than give me error messages, when all was finished I had to have this classic app pool for the module to work. Thanks to lucky abhishek for figuring out the app pool problem first.
Once I was seeing errors I first found that I had other modules in a parent site that could not load. In IIS web.config settings from parent sites are inherited by sites in any virtual sub directories. So I was loading other HttpModules that I didn't care about in this sub site. I fixed this with a quick
<remove name="NameOfModuleIDontHave" />
in the HttpModules section of the web.config in order to straighten that out.
<add type="ParentNamespace.SubNamespace" name="MyClassName" />
<add type="ParentNamespace.SubNamespace.MyClassName" name="MyClassName" />
<add type="ParentNamespace.SubNamespace.MyClassName,App_code" name="MyClassName" />
RSS
1 comments: (+add yours?)
Awesome... solved my problem
Post a Comment