代码或 IIS 6 中的 C# Cache Control

发布于 2024-10-07 09:20:30 字数 266 浏览 0 评论 0原文

当通过移动 3G 网络查看我的网站之一时,网络运营商 o2 在这种情况下重写页面并嵌入所有样式,这导致页面损坏。由于没有正确遵循样式规则。

现在我从 o2 的人那里了解到,我可以通过向我的网站添加“不转换”的缓存控制标题来阻止这种情况发生。

问题是通过 IIS 添加它并不能做任何事情。并且您无法通过 .net 中的代码添加缓存控件“无转换”,因为它不是 system.Web.HttpCacheability 选项之一。

知道如何获取此标头并阻止移动运营商篡改页面吗?

When one of my websites is viewed over a mobile 3G network the network operator o2 in this case is rewriting the page and embedding all the styles in-line, this is causing the page to break. As the styles rules are not followed properly.

Now I understand from the guys at o2 that I can stop this happening by adding a Cache Control heading of "no-transform" to my site.

The problem is that adding this via IIS dosn't seam to do anything. and you cant add the cache control "no-transform" via code in .net as its not one of the system.Web.HttpCacheability options.

Any idea how I can get this header in and stop the page being tampered with by the mobile operator.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

关于从前 2024-10-14 09:20:30

Page_Load 中的 Response.Cache.SetNoTransforms

Response.Cache.SetNoTransforms in Page_Load

鹤仙姿 2024-10-14 09:20:30

您应该能够使用 Response.AddHeader< /a> 方法,如下所示:

Response.AddHeader("cache-control", "no-transform");

用 Firebug 验证了这一点,看起来没问题。

You should be able to use the Response.AddHeader method, like this:

Response.AddHeader("cache-control", "no-transform");

Verified this with Firebug, and it looks OK.

负佳期 2024-10-14 09:20:30

或者,您可以向 HTML 添加元元素,如下所示:

<meta http-equiv="Cache-Control" content="no-transform" />

Alternatively, you could add a meta element to your HTML, like so:

<meta http-equiv="Cache-Control" content="no-transform" />
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文