473,378 Members | 1,688 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

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 2496
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.com> wrote in message
news:36*************@individual.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.de
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?"+<something random>

Eliyahu

"Suraj Joneja" <NO******************@yahoo.com> wrote in message
news:36*************@individual.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?"+<something 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.de
Nov 19 '05 #5
Thank you Joerg,

Setting the no-caching header worked just fine!

thanks all
Suraj
"Joerg Jooss" <ne********@joergjooss.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.de

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********@joergjooss.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?"+<something 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.de

Nov 19 '05 #7

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

Similar topics

1
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...
7
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...
0
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...
1
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...
4
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...
1
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...
9
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",...
4
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,...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.