Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP.Net HttpHandler ProcessRequest() firing twice

I have a strange issue where i have a a HttpHandler having its ProcessRequest() event firing twice.

i have nothing else in the class except a pointer to a static method so i'm lost.

I have done some googling to no avail even thought it appears a few people are having similar issues:

Code:

    public bool IsReusable
    {
        get { return true; }
    }

    public void ProcessRequest(HttpContext context)
    {
        Common.Tracker.TrackPageView(context);
    }
like image 995
Doug Avatar asked Jun 18 '10 04:06

Doug


2 Answers

Scrap this.

I have been testing in firefox and this ONLY happens when i directly call the handler.

If i have the handler set up as an image src this doesn't happen.

additionally in IE this doesn't happen - it is firefox only.

i thought it could be my extensions (specifically firebug or YSLOW), so i manually disabled them one by one and it was still happening so i have no idea but firefox makes two calls to a page.

maybe it is similar to this old post as i'm returning a GIF as the content type: http://www.hanselman.com/blog/InternetExplorerAndTheMagicOfMicrosoftKBArticleQ293792.aspx

hope this helps someone as that is a couple of hours i'll never get back...

like image 87
Doug Avatar answered Oct 20 '22 15:10

Doug


It looks like you are attempting to track a page view; could something on the client be causing the page/handler to get called twice? I have seen similar behavior in the past when the html sent to the browser contained an img tag without the src attribute. This only happened in FireFox, but was causing the page to get called twice. Suggestions: See if there are any images without src tags; use Fiddler or FireBug to inspect the http traffic and ensure that you are not inadvertently calling the handler twice. More details would also be helpful. Hope this helps.

like image 28
David A Moss Avatar answered Oct 20 '22 14:10

David A Moss