473,756 Members | 4,165 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

want to Avoid image cacheing in ASP.NET Pages

I am currently working on my personl website a completely DB driven
web application. in that i ve updating the images thru my admin
panel .. but i am getting the old images not the update one when see
the pages in the front . when i explicitly right click and select
refresh button or hit F5 ,then my pages are loaded with new images..
why this kind of effect is happening. how to avoid the caching of
images in both the server side(page cache) and client side? can anyone
help me to solve this problem. i am accessing the admin module and the
pages in a same computer.

Regards.
Visu

Jan 30 '07 #1
3 2601
The easiest (and certainly not the only) way to ensure that the browser does
not cache images is to suffix the image url with a unique querystring item,
like so:

"http://mysite/images/image001.jpg?id ="+DateTime.Now .Ticks.ToString ()

Peter

--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net


"visu" wrote:
I am currently working on my personl website a completely DB driven
web application. in that i ve updating the images thru my admin
panel .. but i am getting the old images not the update one when see
the pages in the front . when i explicitly right click and select
refresh button or hit F5 ,then my pages are loaded with new images..
why this kind of effect is happening. how to avoid the caching of
images in both the server side(page cache) and client side? can anyone
help me to solve this problem. i am accessing the admin module and the
pages in a same computer.

Regards.
Visu

Jan 30 '07 #2
On Jan 30, 5:05 pm, Peter Bromberg [C# MVP]
<pbromb...@yaho o.yabbadabbadoo .comwrote:
The easiest (and certainly not the only) way to ensure that the browser does
not cache images is to suffix the image url with a unique querystring item,
like so:

"http://mysite/images/image001.jpg?id ="+DateTime.Now .Ticks.ToString ()

Peter

--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net

"visu" wrote:
I am currently working on my personl website a completely DB driven
web application. in that i ve updating the images thru my admin
panel .. but i am getting the old images not the update one when see
the pages in the front . when i explicitly right click and select
refresh button or hit F5 ,then my pages are loaded with new images..
why this kind of effect is happening. how to avoid the caching of
images in both the server side(page cache) and client side? can anyone
help me to solve this problem. i am accessing the admin module and the
pages in a same computer.
Regards.
Visu- Hide quoted text -

- Show quoted text -
thats great idea but now only i ve noticed that all my pages are get
cached in the browser.. how to avoid caching in the browser.. i ve
tried meta tags and setting header parameter to escape caching of
pages.. but no use .. give me handy solution to this problem.

Regards
visu

Jan 30 '07 #3
Thus wrote Visu,
I am currently working on my personl website a completely DB driven
web application. in that i ve updating the images thru my admin panel
.. but i am getting the old images not the update one when see the
pages in the front . when i explicitly right click and select
refresh button or hit F5 ,then my pages are loaded with new images..
why this kind of effect is happening. how to avoid the caching of
images in both the server side(page cache) and client side? can anyone
help me to solve this problem. i am accessing the admin module and the
pages in a same computer.
1) If you serve your images as static content through IIS:
Put all images in a common folder and set a HTTP Cache-Control header for
this folder in IIS manager, e.g.
Cache-Control: no-cache (-never use a cached copy without revalidation)
or
Cache-Control: max-age=43200 (-allow public caching for 12 hours [43200
seconds] at most)

2) If you serve your images as dynamic content through ASP.NET, e.g.
Response.Cache. SetCacheability (HttpCacheabili ty.NoCache);
or
Response.Cache. SetMaxAge(TimeS pan.FromHours(1 2.0));

Note that unless you're updating your images at an astounding pace, marking
them non-cacheable is hardly advisable ;-)

Cheers,
--
Joerg Jooss
ne********@joer gjooss.de
Feb 1 '07 #4

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

Similar topics

10
2409
by: Clive Backham | last post by:
I tried posting this on comp.infosystems.www.misc, but that group appears to get very little traffic. So now I'm trying here. If there is a more appropriate group, please let me know. I'm interested in how cacheing web proxies are expected to behave with regard to pages that change. After changing the content of a simple web site I have, I discovered that the cacheing web proxies at at least one ISP I have access to did not refresh their...
2
1883
by: Marwin | last post by:
Hi all, I have a database with 40GB of binary objects stored in image columns in two tables. Our database server is also used for another 15 databases. SQL Server caches the image-column, causing the cache-hit-ratio to dramatically decrease, since fetching a couple of binaries from the image-column uses up the
5
2148
by: Csaba Gabor | last post by:
Is there any way to determine the pixel height and width of an original image? Specifically, If I have <IMG id=myImg src="pic.jpg" height=200 width=300> can I figure out what the original size of pic.jpg is (had I not placed the height and width attributes on the image, whether in the original tag or later via javascript)?
12
1694
by: Sunny | last post by:
Hi, I need to download some web pages from a web server (most of them are not static html, but .asp pages). The content (I.e. the pure html) in the pages are not changed very often, so I'll looking for a way not to download that pages, which have not been changed since last download. Can someone point me an starting point in that direction? Any examples, etc. Thanks
3
1496
by: Csaba Gabor | last post by:
Not sure of best place for this question... Are there any built in images within the browser that I can assume (particularly IE and FF)? More specifically, I am writing a one file webApp.php application which needs one tiny little folder icon (e.g. http://us.geo1.yimg.com/pic.geocities.com/img/filemgr/folder.gif). Now I could have a second file of the folder icon, but I would rather only have one text file to distribute (namely,...
4
1508
by: Roy | last post by:
Hey all, I just installed 2.0 today. I've been enjoying 1.1 for so long I didn't want to change. :) Anyways, I converted over a web project from 1.1 to 2.0. No problemo. Then I noticed something very bizaare. Here's my short and simple CSS code: SPAN, #lblSailDate { width:100px;
13
4347
by: Viken Karaguesian | last post by:
Hello everyone, Can anyone recommend a good online site to learn PHP? The W3Schools website is quite lacking - leaves much to be desired. I'm sure there are many places, but which ones are good? I currently run a site with an extensive photo gallery. Hundreds of photos. Right now I have a system which the thumbnails are laid out in a table. You click on a thumbnail and you see the full size picture. That full size picture is in its...
9
1500
by: klausklausenator | last post by:
Hi all, I have a php-generated webpage with images. My problem is: the Internet Explorer cannot calculate the correct image size. Because of this the images are not cached. So everytime a user clicks on some link all the images gets retransfered and the page loads very slow. You can check it if you right-click on an image and select properties. Is there a possibility to send the image and its actual size-information to the browser?
7
2456
by: Inny | last post by:
Hello again, Im using the code below in a child page (popup), the images are called from the parent page. When the changer is running, the child page goes white between images. I realise this is happening because the Images are not cached (yet) on the users browser. I tried preloading images with the 2nd code below in the childpage head and in the parent page head and both. no joy, dosent seem to actually 'preload' the pics. (i also gave...
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
9904
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
9884
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
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...
1
3828
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
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.