[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.aspnet.caching

Problem with SetLastModified and Time Drift

Loz Hygate

9/25/2006 3:28:00 PM

I've got a web server running on a separate machine from a database server.
Update timestamps for database entities are based on the database server's
time. I want to be able to create a page with the Last-Modified http header
set to the saved value.

Unfortunately Response.Cache.SetLastModified checks whether the supplied
date is in the future according to the web server. The servers times can
drift apart slightly (though we do have NTP to keep them pretty close).
However, I have seen it being a problem (even with times that only differ by
milliseconds). I'd have thought this would be even more of an issue with
clusters of web servers.

To work round the problem I attempted to set an ETag instead. However, these
pages have cacheability set to private. For some reason ASP won't output an
ETag in those circumstances. I found an article
(http://www.eggheadcafe.com/ng/microsoft.public.dotnet.framework.aspnet.caching/Jul2005/post23...)
that suggests this is by design and that you could use Response.AddHeader if
you really wanted an ETag. However, the framework still silently elides it.
Am I doing something stupid to want to allow a browser to cache a page?

Any other ideas what I can do to get this page cached in the client's
browser? Apart from trying to frig things so the DB server's time is ahead of
the web server's.


2 Answers

Loz Hygate

9/26/2006 8:17:00 AM

0



"Loz Hygate" wrote:

> I've got a web server running on a separate machine from a database server.
> Update timestamps for database entities are based on the database server's
> time. I want to be able to create a page with the Last-Modified http header
> set to the saved value.
>
> Unfortunately Response.Cache.SetLastModified checks whether the supplied
> date is in the future according to the web server. The servers times can
> drift apart slightly (though we do have NTP to keep them pretty close).
> However, I have seen it being a problem (even with times that only differ by
> milliseconds). I'd have thought this would be even more of an issue with
> clusters of web servers.
>
> To work round the problem I attempted to set an ETag instead. However, these
> pages have cacheability set to private. For some reason ASP won't output an
> ETag in those circumstances. I found an article
> (http://www.eggheadcafe.com/ng/microsoft.public.dotnet.framework.aspnet.caching/Jul2005/post23...)
> that suggests this is by design and that you could use Response.AddHeader if
> you really wanted an ETag. However, the framework still silently elides it.
> Am I doing something stupid to want to allow a browser to cache a page?
>
> Any other ideas what I can do to get this page cached in the client's
> browser? Apart from trying to frig things so the DB server's time is ahead of
> the web server's.
>
>

I can just subtract a small constant off each time from the database - I've
picked 10 minutes. I also write a log if the time drift is getting worrying.
Not ideal, but it does the job.

james g. keegan jr.

8/26/2011 12:37:00 AM

0

In article
<c8feaeee-bc22-4b2e-814a-7f72fab422da@y24g2000yqb.googlegroups.com>,
william mosco <wm5772@gmail.com> wrote:

> james g. keegan jr. wrote:
> > In article
> > <f12df969-ef87-482d-abb4-823c68556746@w28g2000yqw.googlegroups.com>,
> > william mosco <wm5772@gmail.com> wrote:
> >
> > > On Aug 24, 9:31?pm, "james g. keegan jr." <jgkee...@gmail.com> wrote:
> > > > In article
> > > > <f9d3676c-f3cf-49fc-aa0e-e6f9a3ef4...@b11g2000vbz.googlegroups.com>,
> > > > ?william mosco <wm5...@gmail.com> wrote:
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > > On Aug 23, 9:11?pm, "james g. keegan jr." <jgkee...@gmail.com> wrote:
> > > > > > In article
> > > > > > <920c98e0-2557-49dc-9c0c-8eec6b6d7...@l4g2000vbz.googlegroups.com>,
> > > > > > ?william mosco <wm5...@gmail.com> wrote:
> > > >
> > > > > > > On Aug 23, 4:31 am, "james g. keegan jr." <jgkee...@gmail.com>
> > > > > > > wrote:
> > > > > > > > In article
> > > > > > > > <b1fc3129-0158-4feb-b4b8-4d3dac34e...@g31g2000yqh.googlegroups.c
> > > > > > > > om>,
> > > > > > > > william mosco <wm5...@gmail.com> wrote:
> > > > > > > > > On Aug 22, 12:59 am, "james g. keegan jr."
> > > > > > > > > <jgkee...@gmail.com>
> > > > > > > > > wrote:
> > > > > > > > > > In article
> > > > > > > > > > <f8b8c680-a36f-4411-8f34-89e867bdb...@l37g2000yqd.googlegrou
> > > > > > > > > > ps.c
> > > > > > > > > > om>,
> > > > > > > > > > william mosco <wm5...@gmail.com> wrote:
> > > >
> > > > > > > > > > > On Aug 20, 11:13 pm, "james g. keegan jr."
> > > > > > > > > > > <jgkee...@gmail.com>
> > > > > > > > > > > wrote:
> > > > > > > > > > > > In article
> > > > > > > > > > > > <7a96f2c1-6041-43f9-9ca7-3d57c93cd...@c29g2000yqd.google
> > > > > > > > > > > > grou
> > > > > > > > > > > > ps.c
> > > > > > > > > > > > om>,
> > > > > > > > > > > > william mosco <wm5...@gmail.com> wrote:
> > > >
> > > > > > > > > > > > > and i choose that i don't have to pay for
> > > > > > > > > > > > > another's choice...
> > > >
> > > > > > > > > > > > you're paying for *your* choice imbecile.
> > > >
> > > > > > > > > > > not how i see it.
> > > >
> > > > > > > > > > you're either blatantly lying again or even more
> > > > > > > > > > illiterate than i previously believed.
> > > >
> > > > > > > > > not surprised you feel that way.
> > > >
> > > > > > > > no problem. it was obvious. equally obvious is how you
> > > > > > > > regularly run away from your own choices and instead blame
> > > > > > > > others for them. not only are you a liar, you're a coward.
> > > >
> > > > > > > i choose to stay dumb ass because like minded people as
> > > > > > > myself will change the direction.
> > > >
> > > > > > so then you lied when you wrote "and i choose that i don't have
> > > > > > to pay for another's choice."
> > > >
> > > > > archie thinks choosing to stay in a country means you need to
> > > > > shut up and pay your taxes...
> > > >
> > > > so which lie ar eyou admitting to?
> > >
> > > archie demonstrates he's the meat head...
> >
> > billy demonstrates his cowardice by running away again.
>
> archie always thought he was smart but here he demonstrates his
> stupidity...

billy continues to demonstrate his cowardice by running away again.