title: IIS7 - Client side caching a .ashx file that already has no-cache data set
body: <p>In IIS7, I have a .ashx file from a third party which sets caching headers to be <code>no-cache,private</code>  </p>
  
  <p>I want this to be cached on the client so I have added the following code to the global.asax</p>
  
  <pre><code>void Application_EndRequest(object sender, EventArgs e)
  {
      if (Request.Path.IndexOf("Script.ashx") &gt; -1)
      {
        Response.Cache.SetCacheability(HttpCacheability.Public);
        Response.Cache.SetExpires(DateTime.Now.AddDays(7));
        Response.Cache.SetValidUntilExpires(true);
        Response.Cache.VaryByHeaders["Accept-Language"] = true;
      }
  }
  </code></pre>
  
  <p>I would expect the resulting cache information to be <code>public, Expires: Thu, 29 Sep 2011 16:06:27 GMT</code></p>
  
  <p>Instead however I get the Franken-response of <code>no-cache,public  Expires: Thu, 29 Sep 2011 16:06:27 GMT</code></p>
  
  <p>So the code is taking replacing the private with public as I want but it fails to replace the no-cache directive.  Is it possible to replace the no-cache directive with this approach: if so what am I missing; if not what other approaches are there?</p>