Asp.net

如何禁用通過 IIS 提供的單頁應用程序 HTML 文件的記憶體?

  • October 28, 2014

我有一個通過 IIS 提供的單頁應用程序(angular-js)。如何防止記憶體 HTML 文件?該解決方案需要通過更改 index.html 或 web.config 中的內容來實現,因為無法通過管理控制台訪問 IIS。

我目前正在研究的一些選項是:

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

引用自:https://stackoverflow.com/questions/26600845