如何强制 ASP.NET 图表控件不被缓存
有谁知道如何强制 ASP.Net Chart 控件生成的图表图像不被缓存?
我尝试将以下内容添加到母版页 Page_Load 方法中,
Response.AddHeader("Pragma", "no-cache");
Response.CacheControl = "no-cache";
Response.Cache.SetAllowResponseInBrowserHistory(false);
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.Cache.SetNoStore();
Response.Expires = -1;
但没有任何乐趣。
有什么想法吗?
谢谢
Does anyone know how to force a chart image generated by the ASP.Net Chart control not to be cached?
I have tried adding the following to the master page Page_Load method
Response.AddHeader("Pragma", "no-cache");
Response.CacheControl = "no-cache";
Response.Cache.SetAllowResponseInBrowserHistory(false);
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.Cache.SetNoStore();
Response.Expires = -1;
With no joy.
Any ideas?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这会导致文件在生成后被删除。下次加载页面时,图表控件应该生成一个带有新 ID 的新图表。
我想主要问题是:您是否 100% 确定浏览器实际上正在缓存图像?
This causes the file to be deleted after generation. The next time the page is loaded the chart control ought to generate a new chart, with a new id.
I guess the main question is: are you 100% certain the browser is actually caching the image?
我不认为在该标记中显式设置 deleteAfterServicing 参数,因为它的默认值为 true。
I don't think to set that deleteAfterServicing parameter explicitly in that tag, because its default value is true.