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.
Solution
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.
THANKS! I must say that you shared very common problem that we usually got & don't know any solution. Useful post. Cheers!
ReplyDeleteexcelente solución no lo había pensado desde ese punto de vista.
ReplyDeletegracias... desde el fin del mundo puerto Montt chile.
That worked for me. Thanks.
ReplyDeleteI am getting error like its not valid virtual path. What can i do for that
ReplyDeletecheck your path of the image folder
DeleteExcellent solution, thank you
ReplyDeleteExcelente, Gracias!
ReplyDeleteOh very good solutin thank you
ReplyDeletethere are amazing people in the world!! Thank you for sharing excellent from las vegas mevada
ReplyDeleteGreat pice of code!! thank you from Las Vegas Nevada
ReplyDeleteDhanyawad . Chumeshwari..
ReplyDeleteThanks man....
ReplyDeleteThanks. its working as charm
ReplyDeleteExcelente mi estimado muchas gracias
ReplyDeleteThank you so much...
ReplyDeletethanks for this code (y)
ReplyDeleteHello.This article was really interesting, particularly because I was investigating for
ReplyDeletethougfhts on this topic last Wednesday.
is there a way to do it on android?
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteIt's superior, however , check out material at the street address. visit this site
ReplyDelete