Search code examples
asp.nethttphandlerhttpmodule

HttpHandler is not processed when its associate HttpModule is processed


In our asp.net 2.0 application we have the an HttpModule and HttpHandler. They are registered in web.config to handle requests for certain file types. The request is initiated asynchronously from client side using MS AJAX. I noticed something strange: HttpHandler:ProcessRequest is not entered on every HttpModule:EndRequest which seems like incorrect behavior since my understanding of the flow of events: HttpModule:BeginRequest > HttpHandler:ProcessRequest > HttpModule:EndRequest. For some reason, the handler part is sometimes skipped. What could be causing this?


Solution

  • If I understand correctly, HttpModule would get executed for every request which comes to your application, while the HttpHandler would execute only for the registered extension.

    So, there could be other request to the app apart from the ones you make to your handler.