Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Avoiding IE Browser Cache

Posted on 2011-03-15
3
Medium Priority
?
466 Views
Last Modified: 2012-06-22
I have a program that makes HTTP based requests for a file from our IIS server.  The file is a text file that contains a number representing the current version.  My program reads the version number and compares it to program's version number to determine if there is an upgrade available.

One of our customers experienced a problem whereby the file is not read from our web server, but instead from their browser's (IE) cache.  

When observing the network with a packet sniffer, it was found that the application on Windows Terminal Server 2003 was checking its IE cache, then formulating the request using the If-Modified-Since header.    A windows XP station is using the Unless-Modified-Since header.  These two headers process in different ways on IIS server.  If I recall correctly, the former was not returning results from the server unless the .txt file date on the server has a modify date greater than the expected date.   The latter will return the file if the date is greater than or equal to the current date.  This generally allows for Windows XP stations to download the file even if it hasn’t necessarily been changed – which appears to be one reason that most people with my software are not typically affected by this.  

Additionally, there are times when the IE cache is handing back an older copy of the file.

One work-around has been to clear the IE cache before having the program do an update check.  This works like a charm.  However, I cannot have every customer that determines they are experiencing this problem clear the IE cache every time they go to do an update.

Ideally, I would like to have the calls to WinInet.InternetOpen() flagged so that they never pull from the browser cache.  However, I do not see in the documentation (http://msdn.microsoft.com/en-us/library/aa385096%28v=vs.85%29.aspx) where it gives me an option for this.  I’m using a  0x0 for the dword dwFLAGS entry currently.

Does anybody have any ideas on how I can make my calls so that the browser cache is never referenced?  The documentation provides for making calls specifically to use the cache only, but I don’t see where I have the option to never use the cache.

0
Comment
Question by:efz
3 Comments
 
LVL 16

Accepted Solution

by:
sjklein42 earned 1000 total points
ID: 35140138
In your program, append "?v=nnnnn" to the URL for the text file, where nnnnn is a random number you generate each time you fetch the file.

This will force it to be loaded fresh from your server, since the URL is different each time.

So instead of fetching

www.yourdomain.com/version.txt

you fetch

www.yourdomain.com/version.txt?v=452746 (for example)

The "CGI" arguments do not affect the fetching of the text file, just the caching.
0
 
LVL 84

Assisted Solution

by:Dave Baldwin
Dave Baldwin earned 1000 total points
ID: 35140214
Here's the Microsoft page about preventing browser caching: http://support.microsoft.com/kb/234067  @sjklein42's idea is a good one also.  In PHP, we frequently use the Unix time stamp as the query string value because people seldom request the page more than once in a second.
0
 

Author Closing Comment

by:efz
ID: 35166353
Sorry for the brief delay in getting back to you. Please accept my sincere thanks for your excellent efforts.
0

Featured Post

NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

What is an ISAPI filter?   •      It's an assembly (.dll file) that can add or change the way IIS works.   •      They can be enabled globally for your web server or on a site-by-site basis.   When the IIS server receives a request, enabling the ISAPI fi…
Debug Tools to analyse IIS process: This article focus on taking memory dumps from IIS to determine which code is taking more time and to analyse which calls hangs/causes more CPU usage. To take dumps,download the following. Install1: To st…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

783 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question