2012-06-16 58 views

回答

1

我想我可能已經回答了我自己的問題!我還需要測試它多一點,也許,如果它不完全工作,然後有人可以糾正我:

<?xml version="1.0" encoding="UTF-8"?> 
<configuration> 
    <system.webServer> 
     <httpProtocol> 
      <customHeaders> 
       <add name="cache-control" value="no-store, no-cache, must-revalidate, max-age=0" /> 
      </customHeaders> 
     </httpProtocol> 
     <staticContent> 
      <clientCache cacheControlMode="DisableCache" /> 
     </staticContent> 
     <security> 
      <requestFiltering> 
       <denyUrlSequences> 
        <add sequence="log.html" /> 
       </denyUrlSequences> 
      </requestFiltering> 
     </security> 
    </system.webServer> 
</configuration> 

高速緩存控制位防止瀏覽器緩存任何東西,它回來了。

希望這可以幫助別人!我對此仍然很陌生,所以你可能能夠解決這個問題。

1

您可以使用IIS URL重寫,並創建一個請求阻擋規則防止over HTTP訪問:

對於例如:

<?xml version="1.0" encoding="UTF-8"?> 
<configuration> 
    <system.webServer> 
    <rewrite> 
     <rules> 
     <rule name="BlockLogFile" 
       patternSyntax="Wildcard" 
       stopProcessing="true"> 
      <match url="*" /> 
      <conditions> 
      <add input="{URL}" pattern="/log.html" /> 
      </conditions> 
      <action type="CustomResponse" 
        statusCode="403" 
        statusReason="Forbidden: Access is denied." 
        statusDescription="This is sekret!" /> 
     </rule> 
     </rules> 
    </rewrite> 
    </system.webServer> 
</configuration> 
+0

由於某種原因,當我使用你的web.config例子我得到一個內部服務器錯誤(500.19)告訴我,有一個問題,閱讀web.config文件... – starbeamrainbowlabs

+0

@starbeamrainbowlabs - 抱歉,從未注意到您的答覆。配置示例直接從我測試的服務器上覆制。你可以發佈500.19頁面的屏幕截圖,它通常非常豐富。 – Kev

+0

是的,我可以,但我怎麼能顯示它在stackoverflow? – starbeamrainbowlabs