Last post May 04, 2021 03:55 PM by ojm37
Mar 18, 2021 07:21 PM|ojm37|LINK
I'm working on moving our website project to a web application project and have run into a problem with httpModule.
I cannot get an httpModule to be run when running the compiled web application project in IIS. When I run it in IIS Express in Visual Studio (2019 16.9.2), it is called. But when I change to Local IIS, the httpModule init method is never called.
<add name="TestModule" type=" ModuleTest.AppCode.httpModule.TestModule"/>
How do I get the httpModule to execute in the Local IIS context?
May 04, 2021 03:35 PM|PatriceSc|LINK
You meant <httpModules>? A breakpoint outside of the module? I would start by using some actual outcome (adding a http header or whatever) to make 100% if the module is not called or if it"s a debugging problem.
Edit: which IIS version do you use?
May 04, 2021 03:55 PM|ojm37|LINK
No, I meant <modules>
I was looking at code in an aspx.cs code-behind file that was actually outputting data that showed that the httpModule was not being called.
The solution was in the way the httpModule is specified (different, slightly than in a website project).
In a website project, I can specify the httpModule with:
<add name="somename" type="namespace.class" />
But, in a web application project, you have to specify the FILENAME of the dll the httpModule is in like this:
<add name="somename" type="namespace.class, filename" />
This was the key to getting this to work in a web application project.
Oh, and I'm using Visual Studio 2019, latest build.