Questions tagged [httpmodule]

ASP.NET HTTP Modules are classes which implement the System.Web.IHttpModule interface.

834 questions
153
votes
8 answers

HTTP handler vs HTTP module

Can someone explain in less than 2 sentences the difference between both? Yes, I know google can provide hundreds of answers but not one in 2 clear sentences:)
frenchie
  • 51,731
  • 109
  • 304
  • 510
88
votes
6 answers

Can I access session state from an HTTPModule?

I could really do with updating a user's session variables from within my HTTPModule, but from what I can see, it isn't possible. UPDATE: My code is currently running inside the OnBeginRequest () event handler. UPDATE: Following advice received so…
Chris Roberts
  • 18,622
  • 12
  • 60
  • 67
84
votes
5 answers

IHttpHandler vs IHttpModule

My question is simple (although the answer will most likely not be): I'm trying to decide how to implement a server side upload handler in C# / ASP.NET. I've used both HttpModules (IHttpModule interface) and HttpHandlers (IHttpHandler interface)…
Dan Esparza
  • 28,047
  • 29
  • 99
  • 127
61
votes
3 answers

HTTPModule Event Execution Order?

Does anyone know of a site or page, or know the order of execution for the events of the HTTPApplication class for HTTPModule event execution? I found the MSDN Documentation for all of the events, but it doesn't show a list of process steps and I…
Adron
  • 2,371
  • 7
  • 25
  • 30
58
votes
1 answer

Why does my nested HttpModule EndRequest event handler not fire?

I'm having some strange behavior when I try to modify my headers with a EndRequest event handler in a nested HttpModule on MVC 5.2.2 and .NET 4.6.2. If I don't modify EndRequest in my top level HttpModule, it appears that the event handler in the…
Thomas Langston
  • 3,743
  • 1
  • 25
  • 41
49
votes
16 answers

Could not load file or assembly 'msshrtmi' or one of its dependencies (Azure Table Storage Access)

I have an HTTPModule that I use to redirect traffic between a website in my data center and a website running on the Azure platform. This HTTPModule retrieves its redirect rules from Azure Table Storage. Redirects work fine on my local dev machine…
William Edmondson
  • 3,619
  • 3
  • 32
  • 41
48
votes
5 answers

Programmatically register HttpModules at runtime

I'm writing an app where 3rd party vendors can write plugin DLLs and drop them into the web app's bin directory. I want the ability for these plugins to be able to register their own HttpModules if necessary. Is there anyway that I can add or…
jmcd
  • 4,269
  • 5
  • 36
  • 36
36
votes
2 answers

How is the order of execution for HttpModules determined?

Suppose that both FirstModule and SecondModule handle the Application_BeginRequest event. Will it execute in the order defined in the web.config?
jessegavin
  • 74,067
  • 28
  • 136
  • 164
36
votes
4 answers

HttpModule Init method is called several times - why?

I was creating a http module and while debugging I noticed something which at first (at least) seemed like weird behaviour. When I set a breakpoint in the init method of the httpmodule I can see that the http module init method is being called…
MartinF
  • 5,929
  • 5
  • 40
  • 29
33
votes
6 answers

How to log request inputstream with HttpModule, then reset InputStream position

I am trying to log the contents of an http request, using an IHttpModule like so: public class LoggingModule : IHttpModule { public void Init(HttpApplication context) { context.BeginRequest += ContextBeginRequest; } private…
cbp
  • 25,252
  • 29
  • 125
  • 205
32
votes
2 answers

How to dispose IHttpModule correctly?

All implementation of IHttpModule I've seen looks following: class HttpCompressionModule : IHttpModule { public void Init(HttpApplication application) { application.SomeEvent += OnSomeEvent; } private void OnSomeEvent(Object source,…
Jakub Šturc
  • 35,201
  • 25
  • 90
  • 110
29
votes
2 answers

Advanced: How many times does HttpModule Init() method get called during application's life?

Web application initialization is as follows: As we know when IIS receives the first request for a particular Asp.net application resource, IIS creates an instance of a HttpApplication (defined in global.asax codebehind). When this new instance is…
Robert Koritnik
  • 103,639
  • 52
  • 277
  • 404
22
votes
1 answer

HttpModule not called in .NET 4.5

Just spent a lot of time sifting through contradictory advice on this problem, and thought I'd post my solution. My environment is .NET 4.5, Visual Studio 2012, working on an MVC 4 application. I created an Http Module like I'd done in the past, and…
timprice
  • 360
  • 1
  • 2
  • 6
21
votes
3 answers

HttpModule not running with Visual Studio

I am using an HttpModule to do some URL shortening on my site. I am using Visual Studio 2008 and IIS 7, and .Net 3.5. When the module is specified in the system.webServer element of web.config, and the site is run in IIS, it works fine. The config…
Matt Sherman
  • 8,298
  • 4
  • 37
  • 57
20
votes
1 answer

HTTP modules and HTTP handlers in ASP.Net MVC?

I was asked a question in interview that how to implement HTTP module and HTTP handler in ASP.Net MVC. I know that they are used in ASP.Net to write pre-processing logic before the aspx page is called. But in ASP.Net MVC we have filters for that so…
rohit singh
  • 1,239
  • 3
  • 15
  • 26
1
2 3
55 56