473,837 Members | 1,727 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Prevent caching by ISP

Hi all

I'am ASP programmer and I have built a site that users can upload and
download files.All things store in a DB and everytime someone enters a
page,the application requery the Db and shows him data.
but there is aproblem:
all my pages caches before Client and i can not see fresh page.for
example if I did some activity on Monday on Wed. i Still see the old
page that was produced on Monday.I have put some header in BOth Html
And ASP files To prevent Caching:

ASP Header:
Response.AddHea der "Cache-Control","Priva te"
Response.AddHea der "Pragma", "no-cache"
Response.Expire sabsolute = Now() - 1
Response.CacheC ontrol = "no-cache"
Response.CacheC ontrol = "Private"
Response.expire s= -1

Html Tags:
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META http-equiv="Cache-Control" Content="no-cache">
<META HTTP-EQUIV="Expires" CONTENT="-1">

it works fine on Client and browser will not cache but the ISP do.i
followed the headers and noticed that old pages come from ISP;so the
question is why
( Response.AddHea der "Cache-Control","Priva te" ) And
( <Meta http-equiv="Cache-Control" Content="no-cache"> ) don't work?
I Called the ISP Admin. but he says they refresh the pages very
quickly.
so where is the problem?

Thanks for attention
Behzad
Jul 23 '05 #1
10 9509
In comp.infosystem s.www.authoring.html Behzad said:
all my pages caches before Client and i can not see fresh page.
you need to come to the realization that as soon as your goodies have
left your server you no longer have any control especially in regards to
cache and design accordingly.
it works fine on Client and browser will not cache


you're delusional

--
v o i c e s
Jul 23 '05 #2
Behzad wrote:
all my pages caches before Client and i can not see fresh page.for
example if I did some activity on Monday on Wed. i Still see the old
page that was produced on Monday.
That's suprising: most browsers are configured "out of the box" to
revalidate a page on each session.
I have put some header in BOth Html And ASP files To prevent Caching: Uh oh...
ASP Header:
Ok, this produces real http headers, so that's good.
Response.AddHea der "Cache-Control","Priva te"
Is the resource really private?
Response.AddHea der "Pragma", "no-cache"
This is an http 1.0 header to defeat all caching. Is such a dramatic
directive really necessarty?
Response.Expire sabsolute = Now() - 1
More questions: Must you expire the page in the past? This means that a
client must revalidate on each load, even if they're merely returning to
a page moments after misclicking.
Response.CacheC ontrol = "no-cache"
Response.CacheC ontrol = "Private"
Response.expire s= -1
These repeat the headers you set, in a different way. Same questions remain.
Html Tags:
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META http-equiv="Cache-Control" Content="no-cache">
<META HTTP-EQUIV="Expires" CONTENT="-1">
These do exactly nothing. Get rid of them, and stop misleading yourself.
it works fine on Client and browser will not cache but the ISP do.


What do you mean? Is your isp running a proxy cache?

My advice: learn about http and caching, and work with caches instead of
against them.

http://www.mnot.net/cache_docs/

--
Brian (remove "invalid" to email me)
http://www.tsmchughs.com/
Jul 23 '05 #3
On Sat, 9 Oct 2004, Brian wrote:
Behzad wrote:
I have put some header in BOth Html And ASP files To prevent Caching: Uh oh...


[...]
My advice: learn about http and caching, and work with caches instead of
against them.

http://www.mnot.net/cache_docs/


All that Brian said; and definitely take some time with that tutorial.

One extra comment:

If your old document is -already- cached, then putting additional
headers into a new version of the page in the hope of defeating
cacheing is *not going to achieve a damned thing*. The client and/or
the cache which is holding the cached old copy is *not going to ask
for a fresh version until it's good and ready*, at which time it is
going to get your new copy anyway (with or without your mumbojumbo
anti-cache stuff).

What you need to do if you're in this situation, and clearing your
browser cache hasn't helped (so you guess that it's in some cacheing
proxy), is to force the cache to refresh *from the client end*.
There is absolutely *nothing* you can do from the *server* side that
can force any client or cache to go looking for a fresh copy, if it's
not yet ready to go asking the server anyway.

If it's a matter of a cached stylesheet, for example, then you'd need
to have your browser force a reload of the stylesheet. In Mozilla,
for example, you can do this by visiting the URL of the stylesheet
itself (not merely of the HTML page that calls it out), and then
command a forced-reload of the URL (ctrl/shift/R or equivalent).

(In the event that the intermediate cache doesn't honour that, then
it's not working to web specifications, i.e it's cacheing more
aggressively than it's really supposed to. So what makes you think
it'll be any less-aggressive in response to some anti-cacheing
headers? All that you're likely to achieve is to make the page much
less comfortable for /other/ readers to access.)
Jul 23 '05 #4
Alan J. Flavell wrote:
On Sat, 9 Oct 2004, Brian wrote:

Behzad wrote:

I have put some header in BOth Html And ASP files To prevent
Caching:


If your old document is -already- cached, then putting additional
headers into a new version of the page in the hope of defeating
cacheing is *not going to achieve a damned thing*.


I hadn't realized what the op was asking. I assumed he was talking about
how his page works in general, but on rereading it, he appears to be
talking about his own browser. So thanks for picking up on that.
If it's a matter of a cached stylesheet, for example, then you'd need
to have your browser force a reload of the stylesheet. In Mozilla,
for example, you can do this by visiting the URL of the stylesheet
itself (not merely of the HTML page that calls it out), and then
command a forced-reload of the URL (ctrl/shift/R or equivalent).


FYI: I've had good luck getting Mozilla to reload linked files -- css
and js -- by force-reloading the linking html page.

Mozilla seems pretty good in that regard, offering users a normal load
while surfing, a chance to reload (sending Cache-Control: max-age=0,
plus if-modified-since and if-none-match where applicable, so that a
conditional GET is possible) or force reload (Pragma: no-cache and
Cache-Control: no-cache, which requests a new copy from the origin
server). Add to that the LiveHTTPHeaders project, and you've got some
solid tools to test with.

--
Brian (remove "invalid" to email me)
http://www.tsmchughs.com/
Jul 23 '05 #5
Behzad (Bs********@yah oo.com) wrote:
: Hi all

: I'am ASP programmer and I have built a site that users can upload and
: download files.All things store in a DB and everytime someone enters a
: page,the application requery the Db and shows him data.
: but there is aproblem:
: all my pages caches before Client and i can not see fresh page.for
: example if I did some activity on Monday on Wed. i Still see the old
: page that was produced on Monday.I have put some header in BOth Html
: And ASP files To prevent Caching:

you can always send a different url when the page is changed.

http://my.server.com/my/page.html?sequence-no=123
^^^
change it each time

The url retrieves the same file each time no matter what the number is,
but each time a browser requests using a different number then the file it
gets cannot be a cached copy.

Note however that the user can end up with multiple versions cached, which
can be confusing if (for example) they use their back button to go to a
page. Also, the "base" page (http://my.server.com/my/page.html) which
would typically be used as a static link is not forced to update, though
that can be good if only some people need to ensure they have the most
recent version (such as someone who is editing the page).

Jul 23 '05 #6
On Sat, 9 Oct 2004, Brian wrote:
If your old document is -already- cached, then putting additional
headers into a new version of the page in the hope of defeating
cacheing is *not going to achieve a damned thing*.


I hadn't realized what the op was asking.


I wasn't sure one way or the other, but it's a misconception that I've
met several times before, so I thought it would do no harm to point it
out. No offence intended...
If it's a matter of a cached stylesheet, for example, then you'd
need to have your browser force a reload of the stylesheet. In
Mozilla, for example, you can do this by visiting the URL of the
stylesheet itself (not merely of the HTML page that calls it out),
and then command a forced-reload of the URL (ctrl/shift/R or
equivalent).


FYI: I've had good luck getting Mozilla to reload linked files -- css
and js -- by force-reloading the linking html page.


Oh, then I guess I was being too pessimistic - sorry.

all the best
Jul 23 '05 #7
On 8 Oct 2004 20:45:47 -0700, Bs********@yaho o.com (Behzad) wrote:
Hi all

I'am ASP programmer and I have built a site that users can upload and
download files.All things store in a DB and everytime someone enters a
page,the application requery the Db and shows him data.
but there is aproblem:
all my pages caches before Client and i can not see fresh page.for
example if I did some activity on Monday on Wed. i Still see the old
page that was produced on Monday.I have put some header in BOth Html
And ASP files To prevent Caching:

ASP Header:
Response.AddHe ader "Cache-Control","Priva te"
Response.AddHe ader "Pragma", "no-cache"
Response.Expir esabsolute = Now() - 1
Response.Cache Control = "no-cache"
Response.Cache Control = "Private"
Response.expir es= -1

Html Tags:
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META http-equiv="Cache-Control" Content="no-cache">
<META HTTP-EQUIV="Expires" CONTENT="-1">

it works fine on Client and browser will not cache but the ISP do.i
followed the headers and noticed that old pages come from ISP;so the
question is why
( Response.AddHea der "Cache-Control","Priva te" ) And
( <Meta http-equiv="Cache-Control" Content="no-cache"> ) don't work?
I Called the ISP Admin. but he says they refresh the pages very
quickly.
so where is the problem?

Thanks for attention


I have just had a CSS caching problem, on a simple HTML based non-dynamic
website. I just could not get my stylesheets to refresh, even if I addressed
them directly, or so I thought.

So, for instance, (simplified) I had page mysite.com/mypage.html with stylesheet
mystyle.css in the same folder. Even if I addressed the stylesheet directly as
mysite.com/mystyles.css, and did a forced reload, I kept on getting the old
stylesheet. I deleted the damn thing, and *still* got it.

However, I suddenly realised that I was misrepresenting the "facts" to myself.

My files were actually at mysubdomain.som ewebs.com and mysite.com was actually
a *redirected* address, using frames, so although I was displaying the content
of the css file, if I looked at "page source" I found :-

<frameset rows="100%,*" border="0" framespacing="0 " frameborder="0" >
<frame src="http://mysubdomain.som ewebs.com/mystyles.css">
</frameset>

Problem resolved - when I thought I was reloading the css file, I was actually
merely reloading the frameset.

So - another thing to think about is the *true* path to your content, rather
than your (mis)conception of it :-)

(Posted this in such detail for posterity and the archive)
Jim

Jul 23 '05 #8
Hi all.

I realized .If in address bar i type
http://mydomain.com

then the browser brings me a non-cached page but if i type
http://www.mydomain.com

then it brings the old one.Any suggestion on this?

Thnaks for ur attention

Behzad
Jul 23 '05 #9
Hi again.
my site acts like an Email service.Each time u visit the site u see
the fresh page;but in my site when i enter the username and
password,after login it shows me older pages but for example
mail.yahoo.com every time shows new pages.what's wrong with me?is
there anything that i have forgotten?

Thanks.
Behzad
Jul 23 '05 #10

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

Similar topics

3
5823
by: Santhi | last post by:
Hi, I wish to avoid caching asp pages at the user end . Currently I have declared Response.Expires=0 at the top of my asp page. I have also used the following meta tags to prevent client side caching <meta HTTP-EQUI="PRAGMA" CONTENT="NO-CACHE"></meta> but still the pages are cached at the client side. Any help or suggesstion would be greatly appreciated to fix this issue
14
5386
by: Ludwig77 | last post by:
I read that there are some tags that can be entered in a web page's meta tags in order to prevent web bot searching and indexing of the web page for search engines. What is the tagging that I would need to use?
5
3141
by: R. Ian Lee | last post by:
I have an ASP.NET page that spawns a popup window using javascript's window.open. This works fine. It pops up, you enter some data, press save and everything saves as it should. But, if you click the button to open the popup again, then it opens with the values that were in it before the "save" was executed. I've determined that the problem is that IE is storing the page in it's local temporary internet files cache and isn't going to...
2
1539
by: gu4y | last post by:
Hello All, Is there anyway to globally prevent client browser caching in ASP.NET? Otherwise, I will have to put: Response.Cache.SetCacheability(HttpCacheability.NoCache); in every page's code-behind... Thanks!
0
1544
by: Frankie | last post by:
When I want to prevent a page from being cached, I have been using the following directive: <%@ OutputCache Location="none" %> I have also seen a few other methods recommended to prevent page caching. like these... Response.Cache.SetCacheability(HttpCacheability.NoCache) Response.Cache.SetNoStore() Response.AppendHeader("Pragma", "no-cache");
1
1645
by: Ronald S. Cook | last post by:
I have an ASPX page wherein I receive an ID of a file to play. http://localhost/fwi/mediaplayer.aspx?id=3 When I go to a browser and type in the above, it works fine. But when I change the 3 to a 4, it still plays the old song. I tried some lines of code to prevent caching, but so far nothing works.
9
6907
by: =?Utf-8?B?SmVmZiBCZWVt?= | last post by:
I'm working on a litigation web app where users will review images of case documents. One of the requirements is that we either prevent the images from being cached on the clients machine (in temp directory or anywhere else) or we encrypt the images somehow. I'm guessing that encryption will not work, but is there a way to prevent caching? Also, is there a way to prevent printing on a current page? We're already not showing the menu...
7
6722
by: mark4asp | last post by:
How can I prevent Caching of JavaScript and CSS files ONLY when I deploy a new application? I only want to force a refresh the first time the client uses the new build. For instance, I'm told I can do it with javascript by including a version number as a querystring like this: <script type="text/javascript" src="../javascript/menu.js?v=2"></ script> However that won't solve the problem of the css files.
0
1463
by: helveticus | last post by:
I have a master/details configuration that includes multiple user controls. The details page is configured to cache data via VaryByCustom. This works fine. One of the user controls contains an image button. With caching turned on, the control remains "lame" since the control is only dynamically generated during the first access. My understanding is that page caching directive causes all page user controls to be implicitly cached as...
0
9693
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,...
1
10638
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
10280
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
9419
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
7012
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
5862
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4481
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
2
4058
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3128
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.