[lnkForumImage]
TotalShareware - Download Free Software

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


 

javawzl

1/9/2007 8:08:00 PM

We have the following directive in a .Net 2 page -

<%@ OutputCache Duration="1800" VaryByParam="None"
Location="ServerAndClient" %>

However, when watching the request/response through Fiddler, the entire page
stream seems to be returned each time ... rather than pulling it from the
browser cache.

Any ideas what could be causing this? When will it be cached on the Server
and when will it be cached on the Client?
4 Answers

Joerg Jooss

1/13/2007 11:22:00 AM

0

Thus wrote javawzl,

> We have the following directive in a .Net 2 page -
>
> <%@ OutputCache Duration="1800" VaryByParam="None"
> Location="ServerAndClient" %>
>
> However, when watching the request/response through Fiddler, the
> entire page stream seems to be returned each time ... rather than
> pulling it from the browser cache.
>
> Any ideas what could be causing this? When will it be cached on the
> Server and when will it be cached on the Client?

It will be
-- cacheable on the client until the duration has expired and
-- cached on the server until either the duration has expired, or the page
has been updated (i.e. ASP.NET detects that it needs to recompile the page).

While the page's cacheability hasn't expired, you'll get a 304 response if
you hit the server again, or a 200 response of the server-side cached copy
if it's an end-to-end reload (e.g. using CTRL-F5 in your browser).
Thus, even in the case of an end-to-end reload, no code is being executed.

How did you test this scenario?

Cheers,
--
Joerg Jooss
news-reply@joergjooss.de


javawzl

1/26/2007 6:57:00 PM

0

We are getting a 200 response on the web page itself; but do get 304s on the
media within the page (after the first load) - images, etc.

Looking at Fiddler, the cacheability is also set to Private ... yet it still
retrieves a new copy each time!

"Joerg Jooss" wrote:

> Thus wrote javawzl,
>
> > We have the following directive in a .Net 2 page -
> >
> > <%@ OutputCache Duration="1800" VaryByParam="None"
> > Location="ServerAndClient" %>
> >
> > However, when watching the request/response through Fiddler, the
> > entire page stream seems to be returned each time ... rather than
> > pulling it from the browser cache.
> >
> > Any ideas what could be causing this? When will it be cached on the
> > Server and when will it be cached on the Client?
>
> It will be
> -- cacheable on the client until the duration has expired and
> -- cached on the server until either the duration has expired, or the page
> has been updated (i.e. ASP.NET detects that it needs to recompile the page).
>
> While the page's cacheability hasn't expired, you'll get a 304 response if
> you hit the server again, or a 200 response of the server-side cached copy
> if it's an end-to-end reload (e.g. using CTRL-F5 in your browser).
> Thus, even in the case of an end-to-end reload, no code is being executed.
>
> How did you test this scenario?
>
> Cheers,
> --
> Joerg Jooss
> news-reply@joergjooss.de
>
>
>

Joerg Jooss

1/31/2007 6:56:00 AM

0

Thus wrote javawzl,

> We are getting a 200 response on the web page itself; but do get 304s
> on the media within the page (after the first load) - images, etc.
>
> Looking at Fiddler, the cacheability is also set to Private ... yet it
> still retrieves a new copy each time!

Actually, you will get 200 for each page request that hits the server, but
you'll always get the cached copy, not a fresh one, unless you've called
Response.Cache.SetValidUntilExpires(false). You should see a Cache-Control:
max-age in each response, and its value will count down until the duration
has expired.

Cheers,
--
Joerg Jooss
news-reply@joergjooss.de


AndyAtBeckbury

2/13/2007 10:17:00 AM

0

Hi, I too have seen the same problem and raised it as a bug with MS. (It also
appears in the .NET 2.0 Framework).

What is happening is that under this scenario the Vary: * HTTP header is
being returned to the browser. This completely invalidates any client
caching. It does not happen for Location="Client" or Location="Any".

My bug report is here
http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?Feedbac...

There is a workaround, but unfortunately it must be added to every page. (Or
you could do it via an HTTPModule for every page).
Add the line:

Response.Cache.SetOmitVaryStar(true);

and this will fix it!