Refreshing an Image on a VB.NET Web Page - modified w/ same file name

F

Fred Nelson

I've written a VB.NET Web application that allows a user to upload a
picture. Once the file has been uploaded, I have an editing process that
allows the user to rotate the image 90 degrees clockwise or
counter-clockwise. The file is converted, saved with the SAME name it had
originally and should be re-displayed with the corrections.

The image is indeed being modified. The problem that I have is that the
original image must be "cached" in memory somehow when its referenced as a
URL since my image display of the image doesn't change. If I click "reload"
I do see the corrected image.

Also - I made a button that changes the images URL to another file and it
works fine - then when I click another button that I made to change it back
I get the "cached" image again.

In the "lab" when I was writing this I had no problem at all when I read the
file from a location on the hard drive "C:\MYFILE\MYPIC.JPG". Now that it
is loaded as a URL I'm having this problem.

Does have any ideas?

Is there a way to force the page to reload - perhaps that's the best
solution?

Thanks,

Fred
 
F

Fred Nelson

Hi Cor:

Thanks for your help!

Actually all that I need to do now to get my system working is to find if
there is a way to call a page refresh as if the user clicked the reload
button. The image files are saved on disk and referenced by a URL

image1.url = "http://weblocation/pic1.jpg

When I make a change to pic1.jpg it does not show up on my page as the
server has obviously cached the prior version of pic1.jpg in memory.
Clicking reload fixes it as does stopping & restarting the development
environment and returning to the page.

So I guess I need a page-reload method - or at least an image1.refresh
method.

Thanks,

Fred
 
C

Cor Ligthert

Fred,

I am not sure of your question, however when you do this for real than you
would have to use in my opinion a GUID for the filename, otherwise another
user would overwrite direct the picture you made (and a clean up method).

Another point is that the browser does not refresh an image with the same
name.
As you wrote, it keeps it in cache. To prevent that you can use something as
this.

Response.Cache.SetExpires(DateTime.Now.AddTicks(500))

I hope this helps?

Cor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top