I'm 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 results in the automatic addition of a no-cache directive in my Cache-Control header:
Cache-Control: public, no-cache="Set-Cookie", must-revalidate, max-age=60
My client happens to handle this directive by straight up not caching the response at all. If I manually remove the no-cache directive before it hits the client, caching works great.
How can I prevent .NET from automatically adding this directive to responses containing cookies?