Help: gif file is still caehced despinte <%@ OutputCache Location="None" %>

Y

YeeCN

Hi,

I have a page which contain a image control for displaying a .gif file. The
application allows the user to upload a different image to replace the
existing one - but when I do Response.redirect() back to the page, the old
image is still being displayed. I need to do a refresh from the browser to
get the new picture.

The old and new pictures are named with the same file name.

I have included a <%@ OutputCache Location="None" %> in the aspx file. I
have also tried using
Response.Cache.SetCacheability(HttpCacheability.NoCache) ;

Any pointers on how to solve this problem?


Thanks in advance.

Yee
 
E

Eliyahu Goldin

Yee,

You can just add a random query parameter to the image url, for example

'something.gif?' + (new Date()).getMilliseconds()

This will trick the browser into downloading from server.

Eliyahu
 
Y

YeeCN

Thanks.

I find using the file lastwritetime, i.e. f.LastWriteTime.ToString("G")
very effective.
Best regards

Yee
 

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

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top