Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Image cache problem

Reply
Thread Tools

Image cache problem

 
 
Bei
Guest
Posts: n/a
 
      10-14-2003
I have a page which has to change 1 image inside periodically. However, I
don't have to modify the page to change. I just replace the old image file
with a new one with the same name.

Then there is a problem of that (images with same name). Everytime there is
a new image, the page still show the old image. Even refreshing the page
doesn't refresh that image. It's because the image name is the same and
browser just load it from the cache even I refresh. So I have to delete
"Temporary Internet Files" to view that image.

Is there a line of code that total disable caching? I have tried:
Response.AddHeader("Pragma", "No-Cache")
But that doesn't work for my case.

Thanks
Victor


 
Reply With Quote
 
 
 
 
Steve C. Orr [MVP, MCSD]
Guest
Posts: n/a
 
      10-14-2003
you can have a special page to dispense your images, such as MyImage.aspx
then when you reference the image you can change the querystring slightly,
such as
<image url='MyImage.aspx?Dummy=1'>
<image url='MyImage.aspx?Dummy=2'>
etc.

This way the browser will see it as a new image each time and won't pull it
from the cache.

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
Hire top-notch developers at http://www.able-consulting.com



"Bei" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> I have a page which has to change 1 image inside periodically. However, I
> don't have to modify the page to change. I just replace the old image file
> with a new one with the same name.
>
> Then there is a problem of that (images with same name). Everytime there

is
> a new image, the page still show the old image. Even refreshing the page
> doesn't refresh that image. It's because the image name is the same and
> browser just load it from the cache even I refresh. So I have to delete
> "Temporary Internet Files" to view that image.
>
> Is there a line of code that total disable caching? I have tried:
> Response.AddHeader("Pragma", "No-Cache")
> But that doesn't work for my case.
>
> Thanks
> Victor
>
>



 
Reply With Quote
 
 
 
 
Kevin Spencer
Guest
Posts: n/a
 
      10-14-2003
You can add a changing Query String to the URL for the image. This causes
the browser to download the image again, as the URL is different. You could,
for example, append a random number to your Query String, as in:

<img src="someImage.jpg?1">

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
http://www.takempis.com
Big Things are made up of
Lots of Little Things.

"Bei" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> I have a page which has to change 1 image inside periodically. However, I
> don't have to modify the page to change. I just replace the old image file
> with a new one with the same name.
>
> Then there is a problem of that (images with same name). Everytime there

is
> a new image, the page still show the old image. Even refreshing the page
> doesn't refresh that image. It's because the image name is the same and
> browser just load it from the cache even I refresh. So I have to delete
> "Temporary Internet Files" to view that image.
>
> Is there a line of code that total disable caching? I have tried:
> Response.AddHeader("Pragma", "No-Cache")
> But that doesn't work for my case.
>
> Thanks
> Victor
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ASP.NET Cache vs Window System Cache Sergey via DotNetMonster.com ASP .Net 0 11-15-2006 03:33 PM
client-side cache vs server-side cache vs ajax vs asp.net callback =?Utf-8?B?b25l?= ASP .Net 1 03-08-2006 12:25 PM
image cache causes trouble, setInterval and innerHTML fail, together, to get me a new image Jake Barnes Javascript 7 12-08-2005 09:09 AM
Page.Cache vs HttpContext.Current.Cache DesignerX ASP .Net 5 01-20-2004 10:55 PM
Cache::Cache Stale Segments Jeff Nokes Perl 0 09-30-2003 04:34 PM



Advertisments