This section is also covered in detail here: Is Safari on iOS 6 caching $ .ajax results?
Another note, however, is not described above.
There was a useful comment re WCF, which is also applicable to ASP.NET MVC re SetCacheability applications. I recommend that these calls be limited to non-GET requests so as not to lose the cache advantage in GET.
I use the base class Controller, which inherits all my controllers for a number of reasons, and it is well established that my redefinition of initialization can handle the settings of my caching headers.
public class SmartController : Controller { ... public HttpContextBase Context { get; set; } protected override void Initialize(System.Web.Routing.RequestContext requestContext) { Context = requestContext.HttpContext; if (Context.Request.RequestType != "GET") { Context.Response.Cache.SetCacheability(HttpCacheability.NoCache); } base.Initialize(requestContext); ... } ... }
source share