Asp.net
如何禁用通過 IIS 提供的單頁應用程序 HTML 文件的記憶體?
我有一個通過 IIS 提供的單頁應用程序(angular-js)。如何防止記憶體 HTML 文件?該解決方案需要通過更改 index.html 或 web.config 中的內容來實現,因為無法通過管理控制台訪問 IIS。
我目前正在研究的一些選項是:
- web.config 記憶體配置文件 - <http://www.iis.net/configreference/system.webserver/caching>
- web.config 客戶端記憶體 - <http://www.iis.net/configreference/system.webserver/staticcontent/clientcache>
- 元標記 -使用 <meta> 標記關閉所有瀏覽器中的記憶體?
IIS 是 .NET 框架 4 的 7.5 版
將以下內容添加到
web.config適用於 Chrome、IE、Firefox 和 Safari 的解決方案中:<?xml version="1.0" encoding="UTF-8"?> <configuration> <location path="index.html"> <system.webServer> <httpProtocol> <customHeaders> <add name="Cache-Control" value="no-cache" /> </customHeaders> </httpProtocol> </system.webServer> </location> </configuration>這將確保在請求時
Cache-Control設置該標頭。no-cache``index.html