title: IIS 8.0 add both Expires header and Cache-Control
body: <p>i can see stackoverflow add's both <code>Expires</code> and <code>Cache-Control</code>  for their images , css, js etc, so i am trying to do the same,  i tried <a href="http://www.aspnetify.com/2014/04/add-expire-header-to-static-content.html" rel="nofollow noreferrer">this</a> article</p>
  
  <p><strong>web.config</strong></p>
  
  <pre><code>&lt;location path="Content"&gt;
      &lt;system.webServer&gt;
        &lt;staticContent&gt;
  
      &lt;clientCache cacheControlCustom="public" cacheControlMode="UseMaxAge" 
      cacheControlMaxAge="365.00:00:00" /&gt;
  
      &lt;clientCache cacheControlMode="UseExpires" httpExpires="Mon, 01 May 2023 00:00:00 GMT" /&gt;
  
        &lt;/staticContent&gt;
      &lt;/system.webServer&gt;
  &lt;/location&gt;
  </code></pre>
  
  <p>when i try to acess a css  file in content folder : <code>http://localhost:11111/Content/bootstrap.min.css</code> </p>
  
  <p>i get the following error</p>
  
  <p><strong>Error</strong>:</p>
  
  <blockquote>
    <p>HTTP Error 500.19 - </p>
    
    <p>Internal Server Error The requested page cannot be accessed because the related configuration data for the page 
        is invalid.</p>
  
  <pre><code>Module           CustomErrorModule
  Notification     SendResponse
  Handler          StaticFile
  Error Code       0x8007000d
  </code></pre>
    
    <p>Config Error     Configuration element 'clientCache' already defined</p>
  </blockquote>
  
  <p>i know <code>clientCache</code> already defined, but i am concerned and want to know how to set both Cache-Control and Expires in response headers ?</p>
  
  <p>Any help would be great.</p>
  
  <p><strong>Update:</strong></p>
  
  <p>As @Vitaly Kulikov answered and discussed in comment and using <a href="https://stackoverflow.com/questions/21548334/implementing-static-files-cache-in-asp-net-mvc">this</a> and <a href="https://stackoverflow.com/questions/20826035/how-to-set-up-both-httpexpires-and-cachecontrol-headers">this</a> posts i came to conclusion that in IIS we can's set both <code>Expires and Cache-Control</code> in web.config, so i have planned to use <a href="https://stackoverflow.com/questions/14769404/how-to-cache-output-of-action-method-that-returns-image-to-the-view-in-asp-net-m">OutputCache</a> to set Expires for images at least and it works with <a href="https://stackoverflow.com/a/1349318/2218697">0.9 milliseconds</a> delay. Hope helps someone. </p>