ASE Home Page Products Download Purchase Support About ASE
ChartDirector Support
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  Disabling image caching
Posted by David S on Apr-24-2012 20:57
ChartDirector uses the unique arguments to prevent image caching.  The downside of this approach is that in older browsers, all of these images are stored in the user's temporary internet files and it can grow to be very large if you're doing fast updates over long periods of time.   Is there a way to disable the unique arguments being passed in with the update requests (streamUpdate or partialUpdate)?

Thanks.

  Re: Disabling image caching
Posted by Peter Kwan on Apr-25-2012 03:34
Hi David S,

The reason the browser cache the image is such that it can avoid reloading the image if the image URL is the same as before. If the URL is not changed, the browser may not even attempt to reload the image from the server (the browser just reloads the image from cache). As a result, the chart may not be changed in the browser display.

To avoid the browser to cache the image, the proper method is to add cache control headers in the HTTP response (in the PreInit event handler). In theory, when the browser sees the cache control header, it will not cache the image. However, from our testing several years ago, the cache control header is not reliable. In some "very old browsers". The browser may ignore them and cache the image anyway, and will not reload the image from the server if the URL has not changed. That's why ChartDirector is designed to change the URL everytime by appending a unique dummy query parameter to the URL. Unluckily, there is no easy method to stop ChartDirector from adding that dummy query parameter.

I think if the browser does support the cahce control header, you may add cache control header in your ASP.NET web page, and the browser should not cache the image. If the browser does not support the cache control header, we would need to change the URL to avoid the browser from using cache.

Regards
Peter Kwan

  Re: Disabling image caching
Posted by David S on Apr-25-2012 04:42
That sounds like a reasonable suggestion.  We will try it out and see if the cache control header alone prevents the browser from storing the image on the hard drive.  We're mainly concerned with Internet Explorer 8.  Thanks and I'll post back if I have anything to add.