ASP.NET Intranet 站点部署后取消缓存用户浏览器内容?

发布于 2024-12-08 23:52:59 字数 191 浏览 0 评论 0原文

是否存在强制用户在 Intranet 部署后刷新缓存的浏览器内容的标准做法?他们往往在浏览器中缓存有冲突的 JavaScript,并且必须按 F5 才能消除 IE 8.0 中的 JavaScript 错误。根据管理层的说法,我们在工作时间进行部署。

需要的是在第一次访问站点时使每个用户的缓存失效/过期,然后让用户正常恢复缓存。

谢谢!

Is there a standard practice for forcing users to refresh their cached browser content after intranet deployments? They tend to have conflicting JavaScript cached in their browsers, and must hit F5 to get rid of JavaScript errors in IE 8.0. Per management, we deploy during business hours.

The need is to invalidate/expire each user's cache a single time on first hit to the site, then let the user resume caching normally.

Thanks!

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

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

发布评论

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

评论(2

夏雨凉 2024-12-15 23:52:59

您无法强制浏览器刷新其缓存,但可以通过向 URL 添加虚拟查询部分来强制其重新加载某些内容:

<script src='js/stuff_that_changes.js?dummy=001'></script>

当您想要强制使用新版本时,可以更新 URL引用“002”、“003”等。具体如何操作在很大程度上取决于您的服务器端技术。

You can't force a browser to flush its cache, but you can force it to reload something by adding a dummy query part to the URL:

<script src='js/stuff_that_changes.js?dummy=001'></script>

When you want to force a new version, you update the URL references to "002", "003", etc. Exactly how you do that depends a lot on your server-side technology.

妞丶爷亲个 2024-12-15 23:52:59

由于您提到这是针对 Intranet 应用程序的,因此在这种情况下您可以采取的一种帮助方法是通过为所有 Intranet 站点内容设置 HTTP 响应标头来更改浏览器可能从 Intranet 站点缓存的所有项目的过期时间。如果预计 Intranet 上的所有用户都有相对较快的连接(即他们都在办公室 LAN 上),那么您可以将过期时间强制设置为非常低的值,除非您有大量用户,否则应该不会有太大问题或者有连接速度较慢的用户。这样,用户浏览器缓存中的所有项目都会相对较快地消失,并且对网站进行频繁更改应该不会有太大问题。以下文章是有关在 IIS7 中配置此功能的方法。

http://technet.microsoft.com/en-us /library/cc770661%28WS.10%29.aspx

Since you mention this is for an intranet application, one approach you can take to help in this type of situation is to alter the expiration of all items the browser might cache from the intranet site by setting the HTTP Response Headers for all intranet site content. If all users on the intranet are expected to have relatively speedy connections (i.e. are they all on the office LAN), then you can force the expiration to a very low value and it should not too problematic unless you have a very large number of users or have users with slower connections. This way all items in the user's browser cache are exiring relatively quickly and you shouldn't have much of an issue with rolling out frequent changes to the site. The following article is a howto on configuring this in IIS7.

http://technet.microsoft.com/en-us/library/cc770661%28WS.10%29.aspx

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