I want to allow cashing for a specific ajax request. Currently the response does not allow this:
HTTP/1.1 200 OK
Cache-Control: private, s-maxage=0
Content-Type: application/json; charset=utf-8
X-SLPROMOTION: DEBUG
X-SourceFiles: =?UTF-8?B?QzpcVXNlcnNcS2F5WmFuZGVyXERvY3VtZW50c1xWaXN1YWwgU3R1ZGlvIDIwMTVcUHJvamVjdHNcc3BvcnRsb29wXHRvb3R3b29cQWNjb3VudFxJc1RyYWluZXI=?=
X-Powered-By: ASP.NET
X-SDL-VERSION: 1.0
Access-Control-Allow-Origin: *
Date: Thu, 20 Oct 2016 13:18:04 GMT
Content-Length: 51
So I set the headers:
public JsonResult MyFunction()
{
HttpContext.Response.Headers.Remove("cache-control");
HttpContext.Response.AppendHeader("cache-control", "public");
...}
but the response still contains:
Cache-Control: private, s-maxage=0
Could this be caused by a global setting or what is the trick here?
答案 0 :(得分:0)