473,757 Members | 2,083 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Image control CACHING IMAGE

Hi All,

I've an image control on my ASP.net page. This displays an image named
'Logo.jpg' in the location '~\Images'. Another application can change this
image. It can select any image and upload to the folder 'Images' and newly
selected image would overwrite existing image 'Logo.jpg'. (Image name
remains same and image changes). The image control on my page doesn't
refresh the newly selected image. it displays the old image where as the
file in the imageUrl is different. I want the image control to
"refresh/reload"
How do I solve this issue????

Thanks

Nov 19 '05 #1
6 2519
Are you sure the problem isn't that the original page is being cached and
therefore the browser isn't seeing the new image URL? Checkout caching of
ASP.Net pages on MSDN.

DalePres
MCAD, MCDBA, MCSE
"Suraj Joneja" <NO************ ******@yahoo.co m> wrote in message
news:36******** *****@individua l.net...
Hi All,

I've an image control on my ASP.net page. This displays an image named
'Logo.jpg' in the location '~\Images'. Another application can change this
image. It can select any image and upload to the folder 'Images' and newly
selected image would overwrite existing image 'Logo.jpg'. (Image name
remains same and image changes). The image control on my page doesn't
refresh the newly selected image. it displays the old image where as the
file in the imageUrl is different. I want the image control to
"refresh/reload"
How do I solve this issue????

Thanks

Nov 19 '05 #2
Suraj Joneja wrote:
Hi All,

I've an image control on my ASP.net page. This displays an image named
'Logo.jpg' in the location '~\Images'. Another application can change
this image. It can select any image and upload to the folder 'Images'
and newly selected image would overwrite existing image 'Logo.jpg'.
(Image name remains same and image changes). The image control on my
page doesn't refresh the newly selected image. it displays the old
image where as the file in the imageUrl is different. I want the
image control to "refresh/reload"
How do I solve this issue????


As the other poster has already pointed out, this is probably not a bug
in your code, as a simple debugging session in VS.NET should point out.

You have to make sure HTTP caches revalidate that your logo is up to
date. You should set a Cache-Control: no-cache header for your "Images"
folder using IIS's admin applet.

Cheers,
--
http://www.joergjooss.de
mailto:ne****** **@joergjooss.d e
Nov 19 '05 #3
You can trick browser into refreshing the image if you add a random number
query parameter to the image url. You can use a timestamp as the parameter.

imageUrl="/Images/Logo.jpg?"+<som ething random>

Eliyahu

"Suraj Joneja" <NO************ ******@yahoo.co m> wrote in message
news:36******** *****@individua l.net...
Hi All,

I've an image control on my ASP.net page. This displays an image named
'Logo.jpg' in the location '~\Images'. Another application can change this
image. It can select any image and upload to the folder 'Images' and newly
selected image would overwrite existing image 'Logo.jpg'. (Image name
remains same and image changes). The image control on my page doesn't
refresh the newly selected image. it displays the old image where as the
file in the imageUrl is different. I want the image control to
"refresh/reload"
How do I solve this issue????

Thanks

Nov 19 '05 #4
Eliyahu Goldin wrote:
You can trick browser into refreshing the image if you add a random
number query parameter to the image url. You can use a timestamp as
the parameter.

imageUrl="/Images/Logo.jpg?"+<som ething random>


But this defeats caches as well, which is not what you want most of the
time -- caches should just send a conditional GET to make sure they
won't serve a stale image file.

It's a trade-off -- either users begind pure HTTP 1.0 caching proxies
see old logos, or the server is hit each and every time to fetch the
logo.

Cheers,

--
http://www.joergjooss.de
mailto:ne****** **@joergjooss.d e
Nov 19 '05 #5
Thank you Joerg,

Setting the no-caching header worked just fine!

thanks all
Suraj
"Joerg Jooss" <ne********@joe rgjooss.de> wrote in message
news:xn******** ********@msnews .microsoft.com. ..
Suraj Joneja wrote:
Hi All,

I've an image control on my ASP.net page. This displays an image named
'Logo.jpg' in the location '~\Images'. Another application can change
this image. It can select any image and upload to the folder 'Images'
and newly selected image would overwrite existing image 'Logo.jpg'.
(Image name remains same and image changes). The image control on my
page doesn't refresh the newly selected image. it displays the old
image where as the file in the imageUrl is different. I want the
image control to "refresh/reload"
How do I solve this issue????


As the other poster has already pointed out, this is probably not a bug
in your code, as a simple debugging session in VS.NET should point out.

You have to make sure HTTP caches revalidate that your logo is up to
date. You should set a Cache-Control: no-cache header for your "Images"
folder using IIS's admin applet.

Cheers,
--
http://www.joergjooss.de
mailto:ne****** **@joergjooss.d e

Nov 19 '05 #6
It depends on the scenario. If the requested resource changes only
occasionally, it may pay to care of caching. If every time the resource has
another content, ignoring caching is fine.

Eliyahu

"Joerg Jooss" <ne********@joe rgjooss.de> wrote in message
news:xn******** ********@msnews .microsoft.com. ..
Eliyahu Goldin wrote:
You can trick browser into refreshing the image if you add a random
number query parameter to the image url. You can use a timestamp as
the parameter.

imageUrl="/Images/Logo.jpg?"+<som ething random>


But this defeats caches as well, which is not what you want most of the
time -- caches should just send a conditional GET to make sure they
won't serve a stale image file.

It's a trade-off -- either users begind pure HTTP 1.0 caching proxies
see old logos, or the server is hit each and every time to fetch the
logo.

Cheers,

--
http://www.joergjooss.de
mailto:ne****** **@joergjooss.d e

Nov 19 '05 #7

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

Similar topics

1
2107
by: Grunt | last post by:
Hi, I have been trying to put together a rotating banner. the code works but I am having a problem with the caching of the banner images. no matter what I try the page is constantly reloading the images, even worse they are not loading completely. This version includes a (vain) attempt at forcing the banner images to cache. Apart form the caching problem the scripting seems to work Any help welcomed:
7
1967
by: Nathan Sokalski | last post by:
I have been trying to find a way to prevent the images on my site from being cached on the user's machine. I want to avoid this because the images used in an Image control often change, yet have the same name. When they are cached, the cached image is displayed which is not what I want. I thought that using Response.Cache.SetCacheability(HttpCacheability.NoCache) would have achieved this, but it seems to only prevent the .aspx file from...
0
939
by: Scott Simes | last post by:
Keywords: image cache caching css stylesheet expire expiration asp.net c# ================================================== Note: I posted this on the caching ng but no one responded... I'm using ASP.NET and C#. I'm trying to figure out if it's possible to set the expiration date or the last modified date for certain documents that get streamed to the user's browser. For example, I use the following HTML to link a stylesheet to an
1
2271
by: Kamyar Souri | last post by:
How can I disable Image caching? I use ASP.NET Image web control that it's ImageUrl is constant but the image is being changed by the code. because of cachin I always see the same image in my Image web control. Thank you in advance.
4
2694
by: Jake | last post by:
Does cookieless session state (with the sessionid embedded into the url) interfere with the browser's retrieval of cached images from one session to the next? Does the sessionid embedded into the url effectively limit client-side image caching to the lifetime of the session? Thanks Jake
1
1896
by: Giggle Girl | last post by:
Hello, I am helping to design a web application that uses 167 little icons on various pages in a framed environment. As is, the app loads each icon on a page by page basis, and if an image changes (like a "plus" becomes a "minus" when a folder icon is expanded) is does a document.all.src="picsV/minus.gif" which I am pretty sure goes and grabs the image at that moment, making no use of caching images at all.
9
1870
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...
4
2281
by: =?Utf-8?B?TWlrZQ==?= | last post by:
Hi. I'm building an ASP.NET 2.0 web-app for a customer. The customer wants a background image that's 124k in size as the background for each page. I've recommended they use a smaller-size image, but the customer is absolutely adamant about using the image. I'm afraid that this large image will degrade performance if it's loaded for each page. Can I somehow use ASP.NET caching to cache the background image so it doesn't have to...
0
9487
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
9297
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10069
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
9735
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...
0
8736
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6556
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5168
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
3
3395
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2697
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.