Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4092108
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T19:27:01+00:00 2026-05-20T19:27:01+00:00

i’m issuing a request using MSXML’s XmlHttpRequest object: IXMLHttpRequest http = new XmlHttpRequest(); http.open(GET,

  • 0

i’m issuing a request using MSXML’s XmlHttpRequest object:

IXMLHttpRequest http = new XmlHttpRequest();
http.open("GET", "http://www.bankofcanada.ca/stat/fx-xml.xml", False, "", "");
http.send();

And the send succeeds, and i get my xml data.

Except that XmlHttpRequest didn’t actually hit the network (i can see there no actual http request issued). And Process Monitor shows the file is actually being served from my cache:

enter image description here

So i want to instruct the XmlHttpRequest user agent that any cached content older than 0 seconds is too old. The standards way to do this is to add a request header:

Cache-Control: max-age=0

to the send request:

http = new XmlHttpRequest();
http.open("GET", "http://www.bankofcanada.ca/stat/fx-xml.xml", False, "", "");
http.setRequestHeader("Cache-Control", "max-age=0");
http.send();

And the send succeeds, and i get my xml data.

Except that XmlHttpRequest didn’t actually hit the network (i can see there no actual http request issued). And Process Monitor shows the file is actually being served from my cache.

So what is wrong? Is max-age not doing what i think it does?

From RFC 2616 – Hypertext Transfer Protocol, Part 14: Header Field Definitions:

Other directives allow a user agent to
modify the basic expiration mechanism.
These directives MAY be specified on a
request:

max-age
Indicates that the client is
willing to accept a response whose age
is no greater than the specified time
in seconds. Unless max- stale
directive is also included, the client
is not willing to accept a stale
response.

Which exactly what i want.

Is Cache-Control: max-age=0 not exactly what i want, or is MSXML’s XmlHttpRequest object buggy?

Update One

This is the MSXML XmlHttpRequest COM object:

  • CLSID: {88d96a0a-f192-11d4-a65f-0040963251e5}
  • ProgID: Msxml2.XMLHTTP.6.0

Update Two

The max-age directive is added by the client for all cache’s to adhere to. From RFC:

The Cache-Control general-header field
is used to specify directives that
MUST be obeyed by all caching
mechanisms along the request/response
chain
. The directives specify behavior
intended to prevent caches from
adversely interfering with the request
or response. These directives
typically override the default caching
algorithms. Cache directives are
unidirectional in that the presence of
a directive in a request does not
imply that the same directive is to be
given in the response.

Max-age is not for the server; it makes no sense for a server. It is intended for all caching systems between the user and the server.

Update Three

From W3C XmlHttpRequest:

If the user agent implements a HTTP cache it should respect
Cache-Control request headers set by
the setRequestHeader() (e.g.,
Cache-Control: no-cache bypasses the
cache). It must not send Cache-Control
or Pragma request headers
automatically unless the end user
explicitly requests such behavior
(e.g. by reloading the page).

Following their example, i tried using the no-cache directive:

http = new XmlHttpRequest();
http.open("GET", "http://www.bankofcanada.ca/stat/fx-xml.xml", False, "", "");
http.setRequestHeader("Cache-Control", "no-cache");
http.send();

And the XmlHttpRequest client still services requests completely from the cache, without querying the server at all.

The W3C says that if there is a cache, it must honor Cache-Control if it is set through setRequestHeader. Microsoft’s XmlHttpRequest doesn’t seem to honor that requirement.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T19:27:01+00:00Added an answer on May 20, 2026 at 7:27 pm

    Unfortunately the XMLHttpRequest object was designed this way, because it is based on WinInet. Also, it is not recommend to be used from the server side. You should use ServerXMLHttpRequest, which has the same functionality, but depends on WinHTTP instead. See the FAQ for more information. A description from the ServerXMLHttp documentation states that:

    The HTTP client stack offers longer
    uptimes. WinInet features that are not
    critical for server applications, such
    as URL caching, auto-discovery of
    proxy servers, HTTP/1.1 chunking,
    offline support, and support for
    Gopher and FTP protocols are not
    included in the new HTTP subset.

    This means that rather than using XmlHttpRequest:

    IXMLHTTPRequest http = CreateComObject("Msxml2.XMLHTTP.6.0");     http.open("GET", "http://www.bankofcanada.ca/stat/fx-xml.xml", False, "", "");
    http.setRequestHeader("Cache-Control", "max-age=0");
    http.send();
    

    you can use ServerXmlHttpRequest:

    IXMLHTTPRequest http = CreateComObject("Msxml2.ServerXMLHTTP");
    http.open("GET", "http://www.bankofcanada.ca/stat/fx-xml.xml", False, "", "");
    http.setRequestHeader("Cache-Control", "max-age=0");
    http.send();
    

    or WinHttpRequest:

    IWinHttpRequest http = CreateComObject("WinHttp.WinHttpRequest.5.1");
    http.open("GET", "http://www.bankofcanada.ca/stat/fx-xml.xml", False, "", "");
    http.setRequestHeader("Cache-Control", "max-age=0");
    http.send();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
Seemingly simple, but I cannot find anything relevant on the web. What is the
Does anyone know how can I replace this 2 symbol below from the string
this is what i have right now Drawing an RSS feed into the php,
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I have a French site that I want to parse, but am running into

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.