473,654 Members | 3,028 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.AddHea der("Pragma", "No-Cache")
But that doesn't work for my case.

Thanks
Victor
Nov 17 '05 #1
2 3393
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.as px?Dummy=1'>
<image url='MyImage.as px?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*******@hotm ail.com.nospam> wrote in message
news:eW******** *****@TK2MSFTNG P10.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.AddHea der("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*******@hotm ail.com.nospam> wrote in message
news:eW******** *****@TK2MSFTNG P10.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.AddHea der("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
4033
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 images (+40) in a single image placeholder on ONE page - pre-loads multiple images - on a click of a mouse changes to the next image - on a click of a mouse changes to the previous image
16
6190
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" onclick="document.all.someimage.src='someimage.jpg"> but how can i determine whether "someimage.jpg" is loaded? and can i get the download percent of a file? Thanks in advance
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 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...
23
5917
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 on most machines, on some machines I experience this problem: When loading the page a window pops up that asks if I want to open the document show_page.asp. When I click "Open" Interdev pops up and opens up a
9
1865
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", and an option for the user to update the photo. If they click the update button, I then flip up a new panel, where I have a FileUpload control and corresponding Upload Button. If they load an image file and click the Upload button, my code uses...
11
5661
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 didn't help. The problem is that this page does not change images after a client uploads a new one. If I hit the browser's refresh, then I can see the updated image, but if I don't refresh, then I see the previous image.
3
3923
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 a frame is drawn around it with resize and rotate buttons. Now it happened to me that I replaced these buttons (32x32) with larger images (48x48). The filenames were not changed, I only copied the new images over the old ones. Then I reloaded the...
8
4047
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 is changing on the server although the URL for it remains the same, but the browser is still displaying the old image from its cache rather than the new image from its URL location.
32
3125
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 had a google, but all I could find were suggestions to use a varying query in the URL. This is not a solution to my problem because if I change the page to do that then ALL the graphs will be reloaded every time.
0
8375
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8815
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8707
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8482
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8593
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6161
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4294
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2714
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 we have to send another system
1
1916
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.