You're a good looking blog, what's your owner's name?

Richard Jonas's blog about .NET, web development and agile methodologies.

Wednesday, November 9

Avoiding images being cached

I saw a question on the Developer Fusion web site today.

This reminded me of a problem we had, where we had image files that were generated from a database, containing graphs of web site usage.

We found the images were frequently cached, and old graphs were shown to our users. To resolve this, we added a QueryString containing a random number after the image file name in the HTML, using simple C# code as follows:

<% System.Random r = new System.Random(); %>
<img src=myimage.gif?<%Response.Write(r.NextDouble()); %>>

0 Comments:

Post a Comment

Links to this post:

Create a Link

<< Home