title: IIS 7.5 forces the http header CacheControl to Private
body: <p>In my .NET code, I have a custom handler that process Http request and in the ProcessRequest Method calls a custom HttpModule to set Http Cache Headers.</p>
  
  <p>The HttpModule sets the header in the PreSendRequestHeaders method with the following code</p>
  
  <pre><code>HttpCachePolicy cache = response.Cache;
  if (cache != null)
  {
    cache.SetCacheability(HttpCacheability.Public);
    cache.SetMaxAge(TimeSpan.FromSeconds(varnishDuration));
    response.AppendHeader("Edge-control", String.Concat("!no-store, max-age=", akamaiDuration, "s dca=noop"));
  }
  </code></pre>
  
  <p>In IIS 7.5, with the pool in integrated mode, the CacheControl is forced to private.
  Here is what I got :</p>
  
  <pre><code>curl -IXGET -H "Host:myHostName" "http://myServer/mypage"
  HTTP/1.1 200 OK
  Cache-Control: private
  Server: Microsoft-IIS/7.5
  X-AspNet-Version: 4.0.30319
  Edge-control: !no-store, max-age=300s dca=noop
  [...]
  </code></pre>
  
  <p>I don't understand why IIS changes the CacheControl to private.</p>
  
  <p>Here is my webserver section in my web.config :</p>
  
  <pre><code>&lt;pre&gt;
  &lt;system.webServer&gt;
      &lt;handlers accessPolicy="Read, Script"&gt;
        &lt;add name="OxygenHandler" verb="*" path="*" type="com.eurosport.oxygen.server.modules.OxygenHandlerFactory, OxygenServerModules" /&gt;
      &lt;/handlers&gt;
      &lt;modules runAllManagedModulesForAllRequests="true"&gt;
        &lt;add name="WebServiceCachingModule" type="com.eurosport.toolkit.WebServiceCachingModule, Eurosport.Toolkit" /&gt;
      &lt;/modules&gt;
    &lt;/system.webServer&gt;
  &lt;/pre&gt;
  </code></pre>
  
  <p>I tried to add SetSlidingExpiration as mentioned here <a href="https://stackoverflow.com/questions/4626780/cache-setmaxage-not-working-under-iis-works-fine-under-vs-dev-srv/5276292#5276292">Cache.SetMaxAge not working under IIS, works fine under VS Dev Srv</a> but it did not help.</p>