gruber
gruber

Reputation: 29749

refresh image path after postback

In my web app I change photo uploaded by user but the path to 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

Upvotes: 3

Views: 602

Answers (3)

Muhammad Akhtar
Muhammad Akhtar

Reputation: 52241

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

Upvotes: 0

Mutt
Mutt

Reputation: 935

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();

Upvotes: 1

mahesh waran
mahesh waran

Reputation: 1

Yes, y not load and bind the grid once again which you use to display the photograph.

Upvotes: 0

Related Questions