[Webinar] Streamline your web hosting managementRegister Today


IE7 turn off cache programmatically

Posted on 2008-02-05
Medium Priority
Last Modified: 2013-12-08
I have an web application created in ASP.NET and VB.NET that produces reports in Crystal and then exports them to PDF to be viewed in the browser. The problem I am having is that some users were upgraded to IE7 and now the reports display the same data no matter if the parameters have changed. IE7 is using the cache to display the report with the same data over and over. How can I turn off the cache on the pdf report?
I have "Check for newer versions of store pages" set to Automatically and included the meta tags
<meta http-equiv="Expires" content="0"/>
<meta http-equiv="Pragma" content="no-cache"/>
<meta http-equiv="Cache-Control" content="no-cache"/>
on the page where the report parameters are passed to no avail.
Question by:Yves Mellet
  • 3
  • 2
LVL 37

Expert Comment

ID: 20831598
I had an issue with this even in IE6....one way around it...that works really consistently...is when you do the export, and set the filename of the pdf, add a random number to the end of the file name, or I used the full date (including date,hours, minutes,seconds, milliseconds). so it would go from:

to something like:

...that way, the files in the user's browser cache won't ever be the same filename...

Author Comment

by:Yves Mellet
ID: 20834530
There is no solution for IE7 to turn off the out of date cache?? or turn it off myself with code? I will adopt your solution if there is nothing better. Thank you for responding.
LVL 101

Expert Comment

ID: 20838320
As you generate the report you could force a refresh of the data through a command to the report object

I don't know exactly how you specify that in ASP.

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.


Author Comment

by:Yves Mellet
ID: 20843151
The application overwrites the previous report which is on the server and opens a new browser windows that points to the new report on the server. But ie uses the report in the cache at the user's box (Temporary Internet Files). No amount of refreshing to the new report could change that since, thanks to the cache, ie picks up the wrong report. If you know maybe how to force a cache refresh or turning off cache for my app would be helpful. I modified IIS in the server in the tab HTTP Headers by checking "Enable Content Expiration" and selecting Expire after 1 minute. That is not ideal because I wish it to give me the option in seconds. If I use the option Expire Immediately the report flickers and does not show at all. I think it is still ie trying to run the cache instead of the actual report it is told to open.
LVL 37

Accepted Solution

samtran0331 earned 1500 total points
ID: 20843214
>>I think it is still ie trying to run the cache instead of the actual report it is told to open.

One way to confirm for absolute sure is
1. run the report.
2. clear the browser cache
3. run the report again.

if you do see the new report data, then it is definitely the user's browser cache.
As a web application, you won't be able to have control over the client's browser and do things like enable/disable their cache.
No amount of changing IIS settings can change this because it is on the client machine, not the web server...

But as in my first suggestion, if you force a unique filename every time...instead of the date, you could even attach a full GUID or something... the client's browser cache will have to serve the file because it should never exist twice in their cache.

Author Closing Comment

by:Yves Mellet
ID: 31428218
I cleared the browser cache but it returns the same file with the same date of creation. I don't really understand but I will adopt your answer because I know it will work. Thank you

Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

Question has a verified solution.

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

It’s a strangely common occurrence that when you send someone their login details for a system, they can’t get in. This article will help you understand why it happens, and what you can do about it.
When you put your credit card number into a website for an online transaction, surely you know to look for signs of a secure website such as the padlock icon in the web browser or the green address bar.  This is one way to protect yourself from oth…
Wufoo.com provides powerful tools for surveying targeted groups, and utilizing data from completed surveys to find trends, discover areas of demand or customer expectation, and make business decisions on products or services.
Learn how to set-up custom confirmation messages to users who complete your Wufoo form. Include inputs from fields in your form, webpage redirects, and more with Wufoo’s confirmation options.

591 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