asp.net mvc disable ajax cache
I load list of data by using ajax and partial view(ascx) But I have a problem: my response is cached. I try to write Responce.Cache.SetExpires(DateTime.Now.AddDays(-1)) in ascx file but it i开发者_高级运维s not helped
In ASP.NET WebForms I've solved this by writing Responce.Cache.SetExpires(DateTime.Now.AddDays(-1)) in codebehind. So I'd like to know where can I write Responce.Cache.SetExpires(DateTime.Now.AddDays(-1)) to disable cache.
Use jQuery?
$.ajax({
cache:false,
...
});
or Controller / Action set OutputCacheAttribute.
OutputCacheAttribute Class (System.Web.Mvc)
You should be using ajax POST to controller method that returns JsonResult if you want to load data from server asynchronously.
精彩评论