简体   繁体   中英

How to remove private from Cache-Control through web.config or IIS settings

I tried many ways to remove private value from cache-control HTTP Response Header, I made it possible through global.asax file but unfortunately I was asked to make this possible either through web.config or IIS settings. Can anyone help me out in resolving this issue.

I tried below code, but didn't work. I am getting private

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

You can add a response header by the following steps:

  1. Open your IIS Manager, navigate to the level you want to manage.
  2. In Features View, Double click “HTTP Respond Headers” feature.
  3. Click “Add…” on the Actions Panel

Fill in the pop-up window: Name: Cache-Control Value: no-cache

截图

OR

You could use the codes below in web.config.

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

Regards, Jalpa.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM