Caching problems in IE

T

tshad

How do we handle Caching in IE?

It seems that my system works fine in Mozilla and Netscape when I make
changes.

But in IE the changes are not brought across when someone has been to the
site before. If they have been here before and hit the same page, the old
page is rendered which will cause errors as things that are expected with
the new changes are not being done, such as session cookies being created or
updated.

I understand you can handle caching from the web.config, but why is IE
having a problem and Mozilla not?

Thanks,

Tom
 
A

Alvin Bruney [ASP.NET MVP]

maybe you should post a code sample of what you are experiencing

--
Regards,
Alvin Bruney
[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
available at www.lulu.com/owc
_________________________
 
T

tshad

Alvin Bruney said:
maybe you should post a code sample of what you are experiencing

How would I do that?

The problem is just that if I go to a page in IE and then makes some
changes - If I go to that same page, my browser will load the old version of
the page. If the old page was looking for something that is not there any
more, I would get an error. As soon as I hit the refresh button, the new
version of the page gets loaded and it works fine.

It is hard to show it - as it is dependent on you loading a page and them my
making a change that would cause it to fail if you re-ran it.

I only have that problem with IE.

Tom
--
Regards,
Alvin Bruney
[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
available at www.lulu.com/owc
_________________________


tshad said:
How do we handle Caching in IE?

It seems that my system works fine in Mozilla and Netscape when I make
changes.

But in IE the changes are not brought across when someone has been to the
site before. If they have been here before and hit the same page, the
old page is rendered which will cause errors as things that are expected
with the new changes are not being done, such as session cookies being
created or updated.

I understand you can handle caching from the web.config, but why is IE
having a problem and Mozilla not?

Thanks,

Tom
 
G

Guest

make sure the IE setting for "Check for newer version of stored pages" is set
to "Automatically", which is the default. For some bizarre reason people
sometimes change this setting to "Never" which leads to the behavior you are
describing.


tshad said:
Alvin Bruney said:
maybe you should post a code sample of what you are experiencing

How would I do that?

The problem is just that if I go to a page in IE and then makes some
changes - If I go to that same page, my browser will load the old version of
the page. If the old page was looking for something that is not there any
more, I would get an error. As soon as I hit the refresh button, the new
version of the page gets loaded and it works fine.

It is hard to show it - as it is dependent on you loading a page and them my
making a change that would cause it to fail if you re-ran it.

I only have that problem with IE.

Tom
--
Regards,
Alvin Bruney
[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
available at www.lulu.com/owc
_________________________


tshad said:
How do we handle Caching in IE?

It seems that my system works fine in Mozilla and Netscape when I make
changes.

But in IE the changes are not brought across when someone has been to the
site before. If they have been here before and hit the same page, the
old page is rendered which will cause errors as things that are expected
with the new changes are not being done, such as session cookies being
created or updated.

I understand you can handle caching from the web.config, but why is IE
having a problem and Mozilla not?

Thanks,

Tom
 
M

Man Manovich

idi_amin said:
make sure the IE setting for "Check for newer version of stored pages" is
set
to "Automatically", which is the default. For some bizarre reason people
sometimes change this setting to "Never" which leads to the behavior you
are
describing.


In "Automatically" mode IE will check for new version of page only once per
session. For development purposes you should set "Every visit to the page"
mode.
 
T

tshad

idi_amin said:
make sure the IE setting for "Check for newer version of stored pages" is
set
to "Automatically", which is the default. For some bizarre reason people
sometimes change this setting to "Never" which leads to the behavior you
are
describing.

That's fine for me.

But I don't want this happening for people that are using my site as it will
not work correctly when I make changes to my pages.

Tom
tshad said:
Alvin Bruney said:
maybe you should post a code sample of what you are experiencing

How would I do that?

The problem is just that if I go to a page in IE and then makes some
changes - If I go to that same page, my browser will load the old version
of
the page. If the old page was looking for something that is not there
any
more, I would get an error. As soon as I hit the refresh button, the
new
version of the page gets loaded and it works fine.

It is hard to show it - as it is dependent on you loading a page and them
my
making a change that would cause it to fail if you re-ran it.

I only have that problem with IE.

Tom
--
Regards,
Alvin Bruney
[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
available at www.lulu.com/owc
_________________________


How do we handle Caching in IE?

It seems that my system works fine in Mozilla and Netscape when I make
changes.

But in IE the changes are not brought across when someone has been to
the
site before. If they have been here before and hit the same page, the
old page is rendered which will cause errors as things that are
expected
with the new changes are not being done, such as session cookies being
created or updated.

I understand you can handle caching from the web.config, but why is IE
having a problem and Mozilla not?

Thanks,

Tom
 
G

Guest

Hi, maybe i wasnt clear:
if the user has setup their browser to behave in this way (so that it will
never check for new versions of pages), then your site in fact should behave
this way. This is a very non-standard browser setup and any user with this
setting will have problems with using websites in general, including Google,
etc, not just your site.

-idi_amin


tshad said:
idi_amin said:
make sure the IE setting for "Check for newer version of stored pages" is
set
to "Automatically", which is the default. For some bizarre reason people
sometimes change this setting to "Never" which leads to the behavior you
are
describing.

That's fine for me.

But I don't want this happening for people that are using my site as it will
not work correctly when I make changes to my pages.

Tom
tshad said:
"Alvin Bruney [ASP.NET MVP]" <www.lulu.com/owc> wrote in message
maybe you should post a code sample of what you are experiencing

How would I do that?

The problem is just that if I go to a page in IE and then makes some
changes - If I go to that same page, my browser will load the old version
of
the page. If the old page was looking for something that is not there
any
more, I would get an error. As soon as I hit the refresh button, the
new
version of the page gets loaded and it works fine.

It is hard to show it - as it is dependent on you loading a page and them
my
making a change that would cause it to fail if you re-ran it.

I only have that problem with IE.

Tom

--
Regards,
Alvin Bruney
[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
available at www.lulu.com/owc
_________________________


How do we handle Caching in IE?

It seems that my system works fine in Mozilla and Netscape when I make
changes.

But in IE the changes are not brought across when someone has been to
the
site before. If they have been here before and hit the same page, the
old page is rendered which will cause errors as things that are
expected
with the new changes are not being done, such as session cookies being
created or updated.

I understand you can handle caching from the web.config, but why is IE
having a problem and Mozilla not?

Thanks,

Tom
 
J

Joerg Jooss

tshad said:
Joerg Jooss said:
tshad said:
"Alvin Bruney [ASP.NET MVP]" <www.lulu.com/owc> wrote in message
maybe you should post a code sample of what you are experiencing

How would I do that?

Dou you do anything in your code that prevents caching?

That's what I am trying to find out.

How do I do this?

Either set the OutputCache directive on your page(s)

<%@ OutputCache Location="None" %>

or set the Cache property of the HttpResponse in your code-behind class:

Response.Cache.SetCacheability(HttpCacheability.NoCache);

(which is equivalent to the directive shown above)

Cheers,
 
T

tshad

Joerg Jooss said:
tshad said:
Joerg Jooss said:
tshad wrote:

"Alvin Bruney [ASP.NET MVP]" <www.lulu.com/owc> wrote in message
maybe you should post a code sample of what you are experiencing

How would I do that?

Dou you do anything in your code that prevents caching?

That's what I am trying to find out.

How do I do this?

Either set the OutputCache directive on your page(s)

<%@ OutputCache Location="None" %>

or set the Cache property of the HttpResponse in your code-behind class:

Response.Cache.SetCacheability(HttpCacheability.NoCache);

(which is equivalent to the directive shown above)

I'll go ahead and try that. That sounds like that will solve my problem.

I can't run the site assuming the user will have his browser set up a
certain way and I would have no way to know if his bowser is caching the
pages (although I suspect there probably is a way to check this). I don't
want him getting errors because of his caching.

Thanks,

Tom.
 
J

Joerg Jooss

tshad wrote:

[...]
I'll go ahead and try that. That sounds like that will solve my
problem.

Not fully. Browser histories are *not* caches, so in theory, none of
those HTTP headers apply. Actually, most browsers do treat histories as
caches, so they work.

I can't run the site assuming the user will have his browser set up a
certain way and I would have no way to know if his bowser is caching
the pages (although I suspect there probably is a way to check this).
I don't want him getting errors because of his caching.

You have to handle this in your web application. There's no way around
that. You must not blindly assume that a certain state exits when
executing any of your pages.

Cheers,
 
G

Guest

tshad said:
I'll go ahead and try that. That sounds like that will solve my problem.

I can't run the site assuming the user will have his browser set up a
certain way and I would have no way to know if his bowser is caching the
pages (although I suspect there probably is a way to check this). I don't
want him getting errors because of his caching.

Hi, keep in mind that while there are techniques which can be used to try to
handle caching, they cannot be guaranteed to work for all users either, based
on their settings and browsers. The solution using the directive will
probably work for most of your users, however, and is probably "good enough".
Also keep in mind that this will degrade the performance of your pages
which use this technique. If your pages are not dynamic and only change once
in a while (new content every few days, etc), then it may not be worth
slowing down the experience for all users, just to make happy the few people
who use this non-standard browser setting.

You have to bite the bullet and make certain assumptions about how a browser
is setup. If you still deny this, are you going build your site to also
support users who have disabled javascript and cookies in their browser?
There are probably many more of those than who have set their browser cache
to never check for new pages. While its certainly possible to design your
site to handle these types of users, you need to ask yourself if its worth
it, or if you maybe should have clearly defined the baseline requirements
during early development. Otherwise you are headed down a very slippery
slope of spending all your time supporting a tiny percentage of users, at the
expense of most of your users.
 
T

tshad

idi_amin said:
Hi, keep in mind that while there are techniques which can be used to try
to
handle caching, they cannot be guaranteed to work for all users either,
based
on their settings and browsers. The solution using the directive will
probably work for most of your users, however, and is probably "good
enough".
Also keep in mind that this will degrade the performance of your pages
which use this technique. If your pages are not dynamic and only change
once
in a while (new content every few days, etc), then it may not be worth
slowing down the experience for all users, just to make happy the few
people
who use this non-standard browser setting.

In my case, the site is dynamic and all the pages are created on the fly
based on users input and the Sql that is generated. Rarely will someone get
the same page.
You have to bite the bullet and make certain assumptions about how a
browser
is setup. If you still deny this, are you going build your site to also
support users who have disabled javascript and cookies in their browser?
There are probably many more of those than who have set their browser
cache
to never check for new pages. While its certainly possible to design
your
site to handle these types of users, you need to ask yourself if its worth
it, or if you maybe should have clearly defined the baseline requirements
during early development. Otherwise you are headed down a very slippery
slope of spending all your time supporting a tiny percentage of users, at
the
expense of most of your users.

I agree.

But I have to deal with the odd time that someone will use a cached page
that does not correspond with the page on the server or the database.

Tom
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top