Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

1 -> I have an image :

 

Image1.ImageUrl = "image.jpg"

 

 

2 -> my page does some operations and replaces that image.jpg with another image.jpg

 

 

3 -> the user clicks a "preview" button to see the new image

 

but the page shows the old image, on page reload. I tried to disable cache, still it doesn't work. It works if I press F5 ( Refresh )

 

Any ideeas ? :(

Development & Research Department @ Elven Soft
Posted (edited)

Run this project

it'll show an image in the ImageBox

 

now manually change the image.gif file with another image.gif ( you have a directory GIFs to pick from ... just rename and over-write)

 

and click the button

 

the image doesn't change :(

Edited by PROKA
Development & Research Department @ Elven Soft
Posted

I see what you mean the only way I have managed to force a change is to use the .image as

 

"image.gif?" & Now.ToString

 

This will work but also means that if the same image appears twice it will be loaded twice and never cached. To test i have used the following code

 

       Dim files() As String = IO.Directory.GetFiles(Server.MapPath("gifs"))
       IO.File.Copy(files((Rnd() * UBound(files))), Server.MapPath("image.gif"), True)
       Image1.ImageUrl = "image.gif?" & Now.ToString

 

Hope that this helps

 

Andy

Code today gone tomorrow!

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...