Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Dec 05, 2011 10:53 PM by rstrahl
Sep 19, 2011 10:03 AM|LINK
I have written a HTTPModule extending IHTTPModule. Can this HTTPModule be installed for a website instead of a virtual directory in IIS.
Like for the whole DefaultWebSite.
Sep 19, 2011 11:01 AM|LINK
Register your HTTPModule in the machine.config file. Below link may help you.
Sep 19, 2011 11:40 AM|LINK
Thanks for the reply.
I have added my custom HTTPModule in web.config file for the web site.
<httpModules> <add type="CustomModule.CusotmModule" name="CustomModule"/> </httpModules>
When I try to access a virtual directory under the web site its trying to load CustomModule.CustomModule.
And throwing an error
Exception information: Exception type: ConfigurationErrorsException Exception message: Could not load type 'CustomModule.CusotmModule'. (c:\inetpub\wwwroot\web.config line 5) (c:\inetpub\wwwroot\web.config line 5)
Sep 19, 2011 11:51 AM|LINK
Have you added the reference to the CustomModule.CusotmModule in your website?
Sep 19, 2011 11:59 AM|LINK
Sorry I didnt understand about adding reference.
How to add the reference.
Sep 19, 2011 12:08 PM|LINK
Is the code for HTTPModule is available under the App_Code directory of the website or is it an external dll?
If it is an external dll file you need to add the reference to the dll file in your website.
Sep 19, 2011 12:15 PM|LINK
It is an external dll.
Sorry for the following question I am new to this IIS and HTTPModules
How to add reference to the dll in the website.
My HTTPModule is also dependent on other dlls.
Sep 19, 2011 12:19 PM|LINK
As it is an external dll, you need to add the reference to the dll to the website.
Check the below link to learn more about adding reference.
Sep 19, 2011 01:04 PM|LINK
May be I was not clear in explaining my issue.
Links you have provided are showing how to add references of a external dll to asp.net applications I create in visual studiol
Here is the issue I am facing.
Under IIS WebSites we have Default Web Site. I have created External Web Site under WebSites with a different IP.
There are virtual directories under both the Default and External web site. I have to apply a custom HTTPModule to only Default Web Site.
If the user access any virtual directory under Default web site the modules kicks in.
If the user access any virtual directory under External web site module shoud not do anything.
So I thought may be this HTTPModule can be configured at the WebSite level instead for each virtual directory.
I created a config file under Default Web Site root folder where I have provided configuration for the HTTPModule.
When I a hit virutal directory URL from browser its trying to load Module but failing with the exception I have sent earlier.
Sorry for the confusion created.
Sep 20, 2011 03:19 AM|LINK
Well, I understood your problem now. As this HTTPModule is going to be common for all the virtual directories, I think you need to add your HTTPModule dll to the GAC.
Can you try adding your dll to GAC, so that it would be referenced in all your virtual directories.