ASP.NET HTTP Modules are classes which implement the System.Web.IHttpModule interface.
Questions tagged [httpmodule]
834 questions
11
votes
4 answers
How to register HttpHandler for all subfolders in Asp.Net?
I would like to register an HttpHandler to include all subfolders of a root folder regardless of how far down they are nested. I would have expected the behavior with the below code to do just that but in fact it only includes items directly in the…

YonahW
- 15,790
- 8
- 42
- 46
11
votes
4 answers
IoC Dependency injection into Custom HTTP Module - how? (ASP.NET)
I have a custom HTTP Module. I would like to inject the logger using my IoC framework, so I can log errors in the module. However, of course I don't get a constructor, so can't inject it into that. What's the best way to go about this?
If you…

UpTheCreek
- 31,444
- 34
- 152
- 221
10
votes
6 answers
Hook into Application_Start in a HttpModule
I’m implementing a simple HttpModule, where I want some code to run when the web application is started. But I’m surprised to find that the Application_Start event I would normally use from Global.asax is not available from a HttpModule. Is that…

Jakob Gade
- 12,319
- 15
- 70
- 118
10
votes
0 answers
HttpModule: How to handle HttpApplication errors without HttpContext?
I'm running into a particularly interesting situation. I have a generic error handling routine currently working. Recently I've noticed a somewhat odd behavior: HttpApplication.Error would fire up, but HttpContext.Current would be null. This is the…

OnoSendai
- 3,960
- 2
- 22
- 46
10
votes
1 answer
ISAPI vs httphandler
In IIS6 was there a reason for using ISAPI filters/ extensions?. Can the same not be achieved using httphandler/ http modules. Also in IIS7 has ISAPI been removed completely ?. Is the entire code of IIS7 written in .Net. I want to know should one…

Prashant
- 2,190
- 4
- 33
- 64
9
votes
1 answer
Can a request be handled and ended prematurely, early in the pipeline?
I have an HttpModule that has bound an event handler to EndRequest.
Is there any way to handle the request inside the event handler? Meaning, I don't just want to run code and keep the request moving -- I want to stop it dead in its tracks, return…

Deane
- 8,269
- 12
- 58
- 108
9
votes
1 answer
When to use HttpHandlers and HttpModules?
When exactly to use HttpHandlers and HttpModules?
Can't I write that code in ASPX pages' code behind?

Manish
- 6,106
- 19
- 64
- 90
9
votes
2 answers
ASP.Net MVC:How to rewrite url by middleware in ASP.NET Core
In asp.net 4.0 we can use work with the http module to rewrite module like so:
protected void Application_BeginRequest(Object sender, EventArgs e)
{
string CountryCodeInUrl = "", redirectUrl="";
var countryCode =…

Mou
- 15,673
- 43
- 156
- 275
9
votes
2 answers
OAuth 2.0 authentication using Apache HTTPd module
Is it possible to implement OAuth 2.0 or 1.0 using an Apache HTTPd server module?
I am choosing this route because each and every request will first reach the HTTPd module, so from there I have to authenticate.
If it is possible, please share a…

Suganth G
- 5,136
- 3
- 25
- 44
9
votes
1 answer
Asynchronous HttpModule MVC
I have a synchronous HttpModule that contains the following code.
///
/// Occurs as the first event in the HTTP pipeline chain of execution
/// when ASP.NET responds to a request.
///
///

James South
- 10,147
- 4
- 59
- 115
8
votes
3 answers
Module registered in IIS7 doens't work
I've created a small Class Library, with a HttpModule that uses a filter to add some html to every requested page served by IIS7.
I tested it first by registering the module in the web.config in a test web site, and it works as it should, but only…

Soeren
- 1,023
- 4
- 22
- 41
8
votes
3 answers
Custom HttpModule for IIS 7 for integrated
I'm having troubles with a custom Error handler I built. It should be a HttpModule, but when I add it to my web.config's system.webServer/modules tag, it is not initiated.
This is my web.config section:

Jonas Verdickt
- 319
- 2
- 5
- 13
8
votes
1 answer
Detecting if a HttpModule is loaded
I'm trying to find a way to programmatically check if a particular HttpModule is loaded (as a component I'm writing requires the module to work correctly). I'm trying:
bool ismodulepresent = false;
foreach(HttpModuleAction module in…

Kieran Benton
- 8,739
- 12
- 53
- 77
8
votes
1 answer
IIS 7.5 ASP.NET HttpModule - Setting Response.Filter results in chunked encoding
I'm trying to create a HttpModule that changes the Response.Filter like so
(for this demonstration just set the filter back to itself):
public class ContentTrafficMonitor : IHttpModule
{
public void Init( HttpApplication context )
{
…

Evan
- 5,925
- 6
- 33
- 35