13

I'm trying to get my header rounder Caching. I have the following code in vb.net:

With HttpContext.Current.Response .Cache.SetCacheability(HttpCacheability.Public) .Cache.SetRevalidation(HttpCacheRevalidation.AllCaches) .Cache.SetLastModified(Now) .Cache.SetExpires(DateTime.UtcNow.AddSeconds(120)) .Cache.SetMaxAge(TimeSpan.FromSeconds(120)) End With 

Which returns the following headers:

Cache-Control: public, no-cache="Set-Cookie", must-revalidate, max-age=120 Content-Type: application/xml; charset=utf-8 Expires: Mon, 22 Aug 2016 13:54:36 GMT Last-Modified: Mon, 22 Aug 2016 13:52:36 GMT 

But I'm trying to figure out what is setting no-cache="Set-Cookie" and how can I switch that on or off?

1

1 Answer 1

7

The no-cache="Set-Cookie" tells the browser not to cache the server "Set-Cookie" header, but follow different rules for the rest of the request. Here's a discussion from W3C http://www.w3.org/Protocols/HTTP/Issues/cache-private.html

In http 1.1, Roy has proposed some features for the new cache-control directive that allow servers to selectively disable caching on specific headers. This would be, for example: cache-control: no-cache="set-cookie"

Sign up to request clarification or add additional context in comments.

1 Comment

The way I understood that document you linked is that if the "Set-Cookie" header is present then the entire response is not cached. Would be good to get clarification on that and also browser support.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.