Why would certain browsers request all pages on my ASP.Net Web site twice?

Posted by Deane on Stack Overflow See other posts from Stack Overflow or by Deane
Published on 2010-03-25T13:18:06Z Indexed on 2010/03/25 13:23 UTC
Read the original article Hit count: 262

Filed under:
|
|
|

Firefox is issuing duplicate requests to my ASP.Net web site. It will request a page, get the response, then immediately issue the same request again (well, almost the same -- see below). This happens on every page of this particular Web site (but not any others). IE does not do this, but Chrome also does this.

I have confirmed that there is no Location header in the response, and no Javascript or meta tag in the page which would cause the page to be re-requested (if any of these were true, IE would be re-requesting pages as well).

I have confirmed this behavior on multiple Firefox installs on multiple machines. Versions vary, but all are 3.x.

The only difference between the two requests is the Accepts header. For the first request, it looks like this:

Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8

For the second request, it looks like this:

Accept: */*

The Content-Type response header in all cases is:

Content-Type: text/html; charset=utf-8

Something else odd -- even though Firefox requests the page twice, it uses the first response and discards the second. I put a counter on a page that increments with every request. I can watch the responses come back (via the Charles proxy). Firefox will get a "1" the first time, and a "2" the second time. Yet it will display the "1," for some reason.

Chrome exhibits this exact same behavior. I suspect it's a protocol-level issue, given the difference in Accepts header, but I've never seen this before.

© Stack Overflow or respective owner

Related posts about firefox

Related posts about http-headers