Last post May 26, 2009 02:44 PM by jlaase
May 18, 2009 02:27 PM|techtalktoe|LINK
I created a HttpModule. Inside the module I am subscribing to the request processing events like so (My HttpModule's purpose is to measure the request begin and end times of my request to the web pages):
public void Init(HttpApplication application)
// Register event handlers.
application.BeginRequest += new EventHandler(OnBeginRequest);
application.PostMapRequestHandler += new EventHandler(OnPostMapRequestHandler);
application.PreRequestHandlerExecute += new EventHandler(OnPreRequestHandlerExecute);
application.EndRequest += new EventHandler(OnEndRequest);
only the PostMapRequestHandler and EndRequest events are fired.
Can any one help me in knowing the reason?
May 20, 2009 10:58 PM|Nai-Dong Jin - MSFT|LINK
HttpApplication.PreRequestHandlerExecute Event occurs just before ASP.NET starts executing an event handler while HttpApplication.BeginRequest Event occurs as the first event in the HTTP pipeline chain of execution when ASP.NET responds to a request. Please
double check on your code, add breakpoints in your code and try to see if it's too late to fire those events.
May 21, 2009 11:05 AM|techtalktoe|LINK
defined in the code behind file. The pagemethod returns me some values which I display in a html table using XSLT and DHTML.
Basically I'm creating a client function for the mouseover tooltip of the Label control. When you hover on the Label text on the browser page, the pagemethod is executed and a html table is shown as a tooltip.
Now, what is happening is that when the pagemethod call is initiated from the client, on the server side the HttpApplication.BeginRequest and HttpApplication.PreRequestHandlerExecute events are not fired. And I have tested with breakpoints.
However, I noticed that the Application.PostMapRequestHandler and Application.EndRequest events do get fired.
Hope this helps.
May 26, 2009 12:41 PM|jlaase|LINK
I have run into this same issue. When using a PageMethod in my ASP.Net page to call back to a static method with the [WebMethod] decorator, I am not seeing the PreRequestHandlerExecut. After doing a lot of research I think that the reason is explained
with this quote from this
"If the request is for a class that implements System.Web.UI.Page and it is a rest method call, the WebServiceData class (that was explained in a previous post) is used to call the requested method from the Page. After the method has been called, the CompleteRequest
method is called, bypassing all pipeline events and executing the EndRequest method. This allows MS AJAX to be able to call a method on a page instead of having to create a web service to call a method."
If you look at the page method request with Fiddler, you will see that it looks something like this. http://<your server>/page.aspx/<webmethod name>/ and the content type is "application/json". My bet is this is being treated like a rest method call vs
a standard page or web service call.
May 26, 2009 02:24 PM|techtalktoe|LINK
That helps. Hope what you said is correct. Thanks.
May 26, 2009 02:44 PM|jlaase|LINK
It seems to work out like it is correct. I have played around with this and run tests with most of the HTTP module events hooked up and what I am seeing agrees with the statement I quoted. Maybe an MS person can come back and verify this for us!