refresh image path after postback
In my web app I change photo uploaded by user but the path t开发者_如何学Co it on the server remains the same. Is it possible after postback to force browser to reload that photo. Right kow it still displays old one. Thanks for help
Sounds like the browser is caching the image.
You can append a fake querystring argument with the current date time to the source of the image to force the browser to reload it every time the page loads.
Ex:
Image img = new Image();
img.ImageUrl = "~/pathToNewImage?q"+DateTime.Now.ToString();
Yes, y not load and bind the grid once again which you use to display the photograph.
It would be better if you use the AJAX AsyncFileUpload
file upload control, since it will give you what you are looking for right now.
http://asp.net-informations.com/ajax/ajax-AsyncFileUpload.htm
精彩评论