【问题标题】:How to remove private from Cache-Control through web.config or IIS settings如何通过 web.config 或 IIS 设置从 Cache-Control 中删除私有
【发布时间】:2019-06-25 19:10:10
【问题描述】:

我尝试了许多方法来从缓存控制 HTTP 响应标头中删除私有值,我通过 global.asax 文件使其成为可能,但不幸的是,我被要求通过 web.config 或 IIS 设置来实现这一点。谁能帮我解决这个问题。

我尝试了下面的代码,但没有成功。我要私密了

<add name="Cache-Control" value="no-cache, no-store, must-revalidate, pre-check=0, post-check=0, max-age=0, s-maxage=0" />

【问题讨论】:

    标签: c# asp.net iis webforms httpresponse


    【解决方案1】:

    您可以通过以下步骤添加响应头:

    1. 打开您的 IIS 管理器,导航到您要管理的级别。
    2. 在功能视图中,双击“HTTP 响应标头”功能。
    3. 点击操作面板上的“添加...”

    在弹出的窗口中填写: 名称:缓存控制 值:无缓存

    您可以在 web.config 中使用以下代码。

    <configuration>
        <system.webServer>
            <staticContent>
                <clientCache cacheControlMode="DisableCache" />
            </staticContent>
        </system.webServer>
    </configuration>
    

    问候, 贾尔帕。

    【讨论】:

      猜你喜欢
      • 2012-10-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-03-15
      • 1970-01-01
      • 2018-11-15
      • 2014-04-08
      相关资源
      最近更新 更多