views:

519

answers:

4

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?

+1  A: 

Do you have that file type set up in IIS to be processed by .net?

Nick
A: 

I believe that calls to Server.Transfer and Response.End can short-circuit the pipeline, is it possible a branch of your logic does this?

jlew
+1  A: 

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.

Ramesh
A: 

I have the similar problem. Please help me to resolve the same....

Problem: There is a website(localhost:85) configure to C:\abc. I have created a seperate website which has HttpModule and HttpHandler in it. This new website should not be in the main application(C:\abc). So I have put a seperate folder like D:\xyz. And configured a virtual directory under port 85.

     Using ISAPI filter whenever related to xyz application request comes, i am mapping the url to \xyz\URIRequest.aspx?RequestURL=ActualQuerystring.

     Issue is the request is reaching the XYZ application Global.asax Application_start(). But it is not going through the pipeline(running httpmodule and httphandler).
     If i configure this XYZ application as a seperate website or creating virtual directory under website with no web.config in it. The application works fine.

Solution tried: 1. Moved the web.config entry of xyz application to Abc application web.config and copy pasted the xyz application dlls to ABC/bin directory. 2. XYZ application web.config httpmodules used command to clear existing httpmodule workflow.

Jaikumar T