Sometime you notice When Image changed on server but browser display previous image from the cache.Its because image with the same name reside in the browser cache so when user request the Image it display the Image from cache.
If you want that image should be change on every request browser not display the image from cache and go to server of evey time for image.then below code will help you.
In C# Code Behind
Img.ImageURl = "~images/Profile.jpg" + "?" + DateTime.Now.Ticks.ToString();
In Javascript
img.src = "~images/profile.jpg" + '?' + Math.random();
Subscribe to:
Post Comments (Atom)

No comments:
Post a Comment