DiigIT | IT Community
No Profile Image
Welcome Guest
New User? Register | Login

Images do not refresh when image get changed on server side

By: rekha singh | 16 Mar 2010 5:32 pm
Problem:

Whenever browser find a request is being made for a image from loaded page, browser picks the image from the cache and displays the same for faster loading of the pages. Thus if the image get changed on server side, the Old cached image is displayed until cache of the browser is cleard.

Comments

Now since it is not possible to clear cache of user’s browser from server side. We can use the following trick

Image1.ImageUrl = "~/images/myImage.jpg?" + DateTime.Now.Ticks.ToString()

The idea is to append some data to the image URL so that the URL becomes unique.

By: rekha singh | 16 Mar 2010

Leave a comment

Enter the text in the image
img
Can't read?
Type the characters you see in the picture below.


Close Move