如何在HTTP响应头中发送Cache-Control:no-cache? [英] How to send Cache-Control: no-cache in HTTP Response header?

查看:573
本文介绍了如何在HTTP响应头中发送Cache-Control:no-cache?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Net 4和C#。

我需要设置发送到浏览器缓存控制( Cache-Control:no-cache )在Web表单页面的HTTP响应标题中。

I would need set send to Browser Cache-Control (Cache-Control: no-cache) in the HTTP Response header for a Web Form page.

知道怎么做吗?

感谢您的时间。

推荐答案

试试这个:

Response.AppendHeader("Cache-Control", "no-cache");

但是,您应该知道单独使用此标题不会为您提供可靠的跨浏览器方式防止缓存。请参阅此答案以获得更准确的解决方案:确保所有浏览器都不会缓存网页

However, you should know that this header alone won't give you a reliable cross-browser way to prevent caching. See this answer for more accurate solution: Making sure a web page is not cached, across all browsers

这篇关于如何在HTTP响应头中发送Cache-Control:no-cache?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆