after upgrade to iOS6.0 release, ajax login page stopped working. It looks like ajax post request made by jquery $.ajax is cached in safari even after adding random querystring parameter and set Cache-control to "no-cache" (these found on net as solution for cache problem). First login attempt works fine, but after logout at second login request browser don't get any response body from server. only headers.
The same is working in IOS 6 GM and 5 versions and in all desktop browsers.
Any Ideas?
i just read this article at ars technica that seem to be related to your problem. It seems to be an Apple "over optimization" of Safari in iOS6.
This topic is also covered in a lot of detail here: Is Safari on iOS 6 caching $.ajax results?
One additional note, however, not covered in the above.
There was a useful comment re WCF that is also applicable to ASP.NET MVC applications re SetCacheability. I recommend that these calls be limited to non-GET requests, to avoid losing the benefit of cache on GETs.
I use a Controller base class that all of my controllers inherit from for a number of reasons, and this served well in that my Initialize override can handle setting 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);
...
}
...
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With