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.
To duplicate:
Create a new Visual Studio project
ASP.NET Web Application (.NET Framework) template
Project Name: ModuleTest, place solution and project in the same directory
Create
Web Froms and Web API
Create
Add new folder: AppCode
Add new subfolder httpModule
Add new item in httpModule subfolder
select ASP.NET Module
Name: TestModule.cs
Add
Put a breakpoint on line 24 (context.LogRequest += new EventHandler(OnLogRequest);)
Add the following code to the web.config file just before the </system.webServer> closing tag:
Member
65 Points
894 Posts
httpModule in Web Application Project not being called
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.
To duplicate:
```
<modules>
<add name="TestModule" type=" ModuleTest.AppCode.httpModule.TestModule"/>
</modules>
```
How do I get the httpModule to execute in the Local IIS context?