472,146 Members | 1,417 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

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.AddHeader "Cache-Control","Private"
Response.AddHeader "Pragma", "no-cache"
Response.Expiresabsolute = Now() - 1
Response.CacheControl = "no-cache"
Response.CacheControl = "Private"
Response.expires= -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.AddHeader "Cache-Control","Private" ) 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 9323
In comp.infosystems.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.AddHeader "Cache-Control","Private"
Is the resource really private?
Response.AddHeader "Pragma", "no-cache"
This is an http 1.0 header to defeat all caching. Is such a dramatic
directive really necessarty?
Response.Expiresabsolute = 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.CacheControl = "no-cache"
Response.CacheControl = "Private"
Response.expires= -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********@yahoo.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********@yahoo.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.AddHeader "Cache-Control","Private"
Response.AddHeader "Pragma", "no-cache"
Response.Expiresabsolute = Now() - 1
Response.CacheControl = "no-cache"
Response.CacheControl = "Private"
Response.expires= -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.AddHeader "Cache-Control","Private" ) 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.somewebs.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.somewebs.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
In article <ae**************************@posting.google.com >, Bsedigh_79
@yahoo.com enlightened us with...
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?


1. Other servers along the way may be caching the page, including your ISP's
server and any proxy servers you may be using.
2. Check your browser settings.
3. Are you expiring the pages? You should. It's a header.

That's all I can think of...

--
--
~kaeli~
Profanity: the single language in which all programmers are
expert.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 23 '05 #11

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

14 posts views Thread by Ludwig77 | last post: by
5 posts views Thread by R. Ian Lee | last post: by
2 posts views Thread by gu4y | last post: by
reply views Thread by Frankie | last post: by
1 post views Thread by Ronald S. Cook | last post: by
9 posts views Thread by =?Utf-8?B?SmVmZiBCZWVt?= | last post: by
reply views Thread by helveticus | last post: by
reply views Thread by Saiars | last post: by
reply views Thread by leo001 | last post: by

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.