asp.net mvc的禁用AJAX缓存 [英] asp.net mvc disable ajax cache
问题描述
我加载数据的列表使用Ajax和局部视图(ASCX) 但我有一个问题:我的反应是缓存。 我试着写Responce.Cache.SetExpires(DateTime.Now.AddDays(-1))在ASCX文件,但它没有帮助
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 is not helped
在ASP.NET的WebForms我在codebehind写Responce.Cache.SetExpires(DateTime.Now.AddDays(-1))解决了这一点。 所以,我想知道我在哪里可以写Responce.Cache.SetExpires(DateTime.Now.AddDays(-1)),以禁用高速缓存。
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.
推荐答案
使用jQuery的?
$.ajax({
cache:false,
...
});
或控制器/动作设置OutputCacheAttribute。
or Controller / Action set OutputCacheAttribute.
OutputCacheAttribute类(System.Web.Mvc)
这篇关于asp.net mvc的禁用AJAX缓存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!