Link to home
Start Free TrialLog in
Avatar of Yves Mellet
Yves MelletFlag for United States of America

asked on

IE7 turn off cache programmatically

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.
Avatar of samtran0331
samtran0331
Flag of United States of America image

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:
filename.pdf

to something like:
filename_200802060819105.pdf

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

ASKER

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.
Avatar of Mike McCracken
Mike McCracken

As you generate the report you could force a refresh of the data through a command to the report object
  RptObj.Refresh

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

mlmcc
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.
ASKER CERTIFIED SOLUTION
Avatar of samtran0331
samtran0331
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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