在 .NET Framework 4.5.1 中,可以使用以下方式禁用缓存返回数据:

HttpContext.Current.Response.Cache.SetCacheability(HttpCacheability.NoCache);
HttpContext.Current.Response.Cache.SetNoStore();

这将设置响应头,指示浏览器不要缓存返回数据。

c# webapi 里的代码 responseHeadersCacheControl = new CacheControlHeaderValue NoCache = true ;转为net451能支持的格式 返回数据禁用缓存

原文地址: https://www.cveoy.top/t/topic/8FR 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录