473,503 Members | 1,639 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Image cache problem

Bei
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
Nov 17 '05 #1
2 3379
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" <ka*******@hotmail.com.nospam> wrote in message
news:eW*************@TK2MSFTNGP10.phx.gbl...
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

Nov 17 '05 #2
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" <ka*******@hotmail.com.nospam> wrote in message
news:eW*************@TK2MSFTNGP10.phx.gbl...
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

Nov 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
4022
by: Wonko | last post by:
Here's my problem if anyone could be so kind to help me out. I assume it's quite easy for an experienced programmer but I'm not one of them :) I have a JavaScript code that: - displays multiple...
16
6169
by: Donjuan | last post by:
Hi all I have trouble with tracking whether my image file is loaded. i use DHTML to change my image. HERE is the code: <img name="someimage" src="1.jpg"...
3
614
by: Bei | last post by:
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...
23
5872
by: Peter | last post by:
I have a problem with a page show_image.asp that returns a jpg image under Windows XP Pro SP2. The page sets content type as: Response.ContentType = "image/jpg" While this works perfectly fine...
9
1860
by: Mark Denardo | last post by:
This is related to another post I submitted, but I'll be more precise this time. I have a web page that contains an Image webcontrol that loads its image by: Image1.ImageUrl="<username>.jpg",...
11
5649
by: Jerry J | last post by:
How can I get an asp:Image to refresh when a user uploads a different jpg. I disabled caching using this command on Page_Load(): Response.Cache.SetCacheability(HttpCacheability.No Cache); but it...
3
3909
by: kayahr | last post by:
Hi there, I have a strange problem in Internet Explorer (IE6 and IE7). I'm writing a JavaScript application which allows the user to edit a photo composition. So when the user selects a photo then...
8
4042
by: Edward Diener | last post by:
Is there a way in Javascript, or perhaps in HTML, to force a browser to re-render an image on an HTML page after a round-trip between the client and the server ? In my particular case, the image...
32
3092
by: C. (http://symcbean.blogspot.com/) | last post by:
Hi all, I have an application which generates image graphs. These cache nicely at the client, however if the user submits more data, I'd like to force a reload of the image from the server. I...
0
7202
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7278
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7458
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5013
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4672
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3167
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3154
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1512
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
736
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.