我开发了一个纯粹的 html 5,css和jquery 网站。主要针对智能设备。它部署在 IIS服务器。
上我的客户正在IE,Chrome等桌面浏览器上测试此网站。
每当我进行任何部署时,客户端的浏览器都会从浏览器缓存中选择页面。它们不是直接从服务器获取的。我不想在每个html页面上进行URL更改,因此浏览器可以将其识别为新页面。相反,我想,因为这部署在IIS上,我只能在一个地方进行更改,即 Global.ascx。
所以这就是我在Global.ascx中所做的。
void Application_PreSendRequestHeaders(Object sender, EventArgs e)
{
HttpContext.Current.Response.Cache.SetCacheability(HttpCacheability.NoCache);
HttpContext.Current.Response.Cache.SetNoStore();
}
请注意,我的应用程序没有任何 web.config ,因为它不需要任何。 现在浏览器仍在从缓存中选择页面。
请指教。感谢
答案 0 :(得分:0)
<configuration>
<system.webServer>
<staticContent>
<clientCache cacheControlMode="DisableCache" />
</staticContent>
</system.webServer>
</configuration>