How to register an HttpModule that is not in the App_code folder
I would like to have my code for an HttpModule somewhere else than in the App_code folder, is that possible?
EDIT: For now, i have my module in a class file in the App_code folder of my web application. I'm successfuly registering it with this line in my web.config
<httpModules> <add name="myModule" type="myModule,App_code"/> </httpModules>
What i would like to do is being able to put my class file somewhere else than in the Ape_code folder. Something like :
<httpModules> <add name="myModule" type="myModule, myOtherFolder"/> </httpModules>
So, finaly, here's how I solved my problem. I found that to register an HttpModule, you have to use the foollowing syntax.
<httpModules> <add name="MyModuleName" type="MyApplicationNamespace.MyModuleNamespace.MyModuleClassName, MyApplicationAssemblyName"/> </httpModules>
- MyModuleName is not restrictive, it is used by the application to reference the module
- Since MyApplicationName and MyApplicationAssemblyName is often the same (it is in my case), it is probable that the syntax above isn't totaly acurate.
Hope this can help someone else.
Yes, it is possible. You'll have to switch from "Web Site Project" to "Web Application Project." Here are a few resources to get you started: