如何关闭整个 ASP.NET MVC 站点的浏览器缓存?

发布于 2024-09-12 07:36:19 字数 64 浏览 3 评论 0原文

我想禁用网站上每个页面的浏览器缓存。我知道我可以按操作执行此操作,但我想知道是否有办法在整个站点范围内执行此操作。

I'd like to disable browser caching for every page on my site. I know I can do it per action, but I'd like to know if there's a way to do it site-wide.

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

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

发布评论

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

评论(2

无法言说的痛 2024-09-19 07:36:19

拜伦 - 根据你的推动:)

add the pragma no-cache directive header into the master page!!

大致如下:

<meta http-equiv="Expires" content="0">
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Cache-Control" content="no-cache">

干杯 - 周末愉快,

吉姆

Byron - as per your nudge :)

add the pragma no-cache directive header into the master page!!

along the lines of:

<meta http-equiv="Expires" content="0">
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Cache-Control" content="no-cache">

Cheers -have a good weekend

jim

水中月 2024-09-19 07:36:19

如果您使用自定义基本控制器类,您可以重写它的 OnResultExecuting() 方法,并将每个操作使用的相同代码放在那里。

If you use custom base controller class, you can override it's OnResultExecuting() method and put the same code you would use per action there.

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