Problem: Image Control again showing the same Image

  • Thread starter Thread starter Sandeep Singh Sekhon
  • Start date Start date
S

Sandeep Singh Sekhon

I am developing an application in ASP.NET 1.1. on one page I allow the
user to upload and delete the files to the server.
When I delete the file, I physically delete the file from the location.
Then I again prompt the user to load a new file but I save the file with
the same name the earlier image file had been saved. The problem is that
when I again upload the page through Response.Redirect after uploading,
it is showing the same image it was showing before deletion whereas in
that location on server, there is another image. How my view of the
image in the Image Control will change when a new picture has come.


Please give me any suggestion. All your suggestion are welcome.

Thanks in advance

Thanks,
Sandeep S. Sekhon
 
Either save the image with different name or append a unique id to image url
for new upload.

ImageUrl="MyImage.jpg?<GUID or something>
 
Hi Sandeep,

If the image file name doesn't change, even the image itself changes, the
browser will use the image from cache. To force the browser use fresh copy,
you can append something to the image url to make the browser think the url
changes.

myImageCtrl1.ImageUrl = "images/test.gif?id="+DateTime.Now.Ticks.ToString();

Hope this helps. Please feel free to post here if anything is unclear.

Regards,
Walter Wang ([email protected], remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
 
Hi Sandeep,

I am interested in this issue. Would you mind letting me know the result of
the suggestions? If you need further assistance, feel free to let me know.
I will be more than happy to be of assistance.

Have a great day!

Regards,
Walter Wang ([email protected], remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
 
Back
Top