Search code examples
c#iishttp-headers3ghttp-caching

c# Cache Control in code or IIS 6


When one of my websites is viewed over a mobile 3G network the network operator o2 in this case is rewriting the page and embedding all the styles in-line, this is causing the page to break. As the styles rules are not followed properly.

Now I understand from the guys at o2 that I can stop this happening by adding a Cache Control heading of "no-transform" to my site.

The problem is that adding this via IIS dosn't seam to do anything. and you cant add the cache control "no-transform" via code in .net as its not one of the system.Web.HttpCacheability options.

Any idea how I can get this header in and stop the page being tampered with by the mobile operator.


Solution

  • You should be able to use the Response.AddHeader method, like this:

    Response.AddHeader("cache-control", "no-transform");
    

    Verified this with Firebug, and it looks OK.