ASP.NET Image Refresh after upload

Although the file was changing on the server, the file name was staying the same. This results in the browser displaying the old file as it is being retrieved by the browsers cache. To avoid this problem you need to add a unique querystring parameter to the image url. You can achieve this with the following code:

  string lsTimeStamp = DateTime.Now.ToString("yyyyMMddhhmmss");
   imgLoadimage.ImageUrl = " image url  +"?ts=" + lsTimeStamp;

    

Comments

Popular posts from this blog

How to retain the data annotations or class during modify a table in the database

Interview Questions

AJAX CONTROL