I am currently returning a cookie from a web service with code like this:
HttpResponse response = ...; var cookie = new HttpCookie(cookieName) { Value = cookieValue, Expires = expiresDate, HttpOnly = true, Path = "/", Secure = true, }; response.Cookies.Add(cookie);
This causes the directive to be automatically added without a cache to my Cache-Control header:
Cache-Control: public, no-cache = "Set-Cookie" , required-revalidate, max-age = 60
My client handles this directive simply by not caching the response. If I manually delete the directive without a cache before it hits the client, caching works fine.
How can I prevent .NET from automatically adding this directive to responses containing cookies?
source share