How to refresh an image in ASP.NET

When you upload a new image which already exists then the old visitor should refresh the browser cache to see it.

To resolve this problem you could each time generate some random number after the image name, and the browser will think that this is a new image and it will refresh it. This is the sample ASP.NET code:

<img src=”<%=YourImage + “?” + RandomNumber.ToString()%>”>