Refresh image in asp:Image-control

G

Guest

Hello!

I've seen a lot of post about this but every one of them ends up with the
same solution:

Set:

Response.Cache.SetExpires(new DateTime(2000, 1, 1)); // some date in the
past....
Response.Cache.SetCacheability(HttpCacheability.NoCache);

and use:
myPic.ImageURL = picURL + "?time=" + DateTime.Now.Ticks

or something like that. This has worked for me too, until now. One customer
can't get the picture to refresh. I've checked that the image-file changes on
the server and that the src value of the img-tag in the page is different.
Everything changes as it should except the image. How can I force it to show
the right image?

Thanks!
 
M

MasterGaurav \(www.edujini-labs.com\)

or something like that. This has worked for me too, until now. One
customer
can't get the picture to refresh. I've checked that the image-file changes
on

Have you checked the customer's client settings for cache?
Is it, accidently, set to "Never lookup data on network" (always use cache)?


--
Happy Hacking,
Gaurav Vaish | www.mastergaurav.com
www.edujini-labs.com
http://eduzine.edujini-labs.com
-----------------------------------------
 
G

Guest

Hi,
try appending a random number to the image url.

For example,

string url = string.format(imagepath.gif?r={0}, rnd()*10000)

Hopefully this has helped you.
 
G

Guest

Where can you find this setting? I connected my computer to their network and
tried it with the same result so I guess it's not an issue with Internet
Explorer settings.
 
G

Guest

Thanks!

I'll try that but I doubt it makes any difference. Using the Ticks value in
the imageurl also gives a different number each time. I've even controlled it
on the client.

Regards
 
M

Mark Fitzpatrick

It could actually be their network provider. Keep in mind, some providers
still have proxy servers that cache files to save on bandwidth. AOL used to
be horrible at this, even caching whole web sites and displaying some that
were days old.

Chances are, if it's happening on their network the network admin has made a
setting somewhere on their domain controller or it has something to do with
their network connection to the internet and a setting on a proxy server or
router.
 
J

Joerg Jooss

Thus wrote Miro,
Hello!

I've seen a lot of post about this but every one of them ends up with
the same solution:

Set:

Response.Cache.SetExpires(new DateTime(2000, 1, 1)); // some date in
the
past....
Response.Cache.SetCacheability(HttpCacheability.NoCache);
and use:
myPic.ImageURL = picURL + "?time=" + DateTime.Now.Ticks
or something like that. This has worked for me too, until now. One
customer can't get the picture to refresh. I've checked that the
image-file changes on the server and that the src value of the img-tag
in the page is different. Everything changes as it should except the
image. How can I force it to show the right image?

None of those is a solution if your images are served by IIS directly. Is
this the case here?
 

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

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,822
Latest member
israfaceZa

Latest Threads

Top