title: IIS understand static files in MVC as dynamic content
body: <p>Playing with the httpCompression I relalized that IIS understand static files in MVC as dynamic content, so even if you tick the "<strong>Enable static content compression</strong>", but don't tick "<strong>Enable dynamic content compression</strong>", IIS will return the <code>.css</code> and <code>.js</code> files without compression:</p>
  
  <pre class="lang-none prettyprint-override"><code>GET /MVCX/Content/Site.css HTTP/1.1
  Host: localhost
  Connection: keep-alive
  User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.2 (KHTML, like Gecko) Chrome/15.0.874.121 Safari/535.2
  Accept: text/css,*/*;
  Referer: http://localhost/mvcx/
  Accept-Encoding: gzip,deflate,sdch
  Accept-Language: en-GB,en-US;q=0.8,en;q=0.6
  Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3
  
  HTTP/1.1 200 OK
  Content-Type: text/css
  Last-Modified: Mon, 05 Dec 2011 12:42:37 GMT
  Accept-Ranges: bytes
  ETag: "c79895e4bb3cc1:0"
  Server: Microsoft-IIS/7.5
  X-Powered-By: ASP.NET
  Date: Mon, 05 Dec 2011 12:44:43 GMT
  Content-Length: 1005
  </code></pre>
  
  <p>But then if I tick the "<strong>Enable dynamic content compression</strong>" the files are compressed:</p>
  
  <pre class="lang-none prettyprint-override"><code>GET /MVCX/Content/Site.css HTTP/1.1
  Host: localhost
  Connection: keep-alive
  User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.2 (KHTML, like Gecko) Chrome/15.0.874.121 Safari/535.2
  Accept: text/css,*/*;
  Referer: http://localhost/mvcx/
  Accept-Encoding: gzip,deflate,sdch
  Accept-Language: en-GB,en-US;q=0.8,en;q=0.6
  Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3
  
  HTTP/1.1 200 OK
  Content-Type: text/css
  Content-Encoding: gzip
  Last-Modified: Mon, 05 Dec 2011 12:42:37 GMT
  Accept-Ranges: bytes
  ETag: "c79895e4bb3cc1:0"
  Vary: Accept-Encoding
  Server: Microsoft-IIS/7.5
  X-Powered-By: ASP.NET
  Date: Mon, 05 Dec 2011 12:48:36 GMT
  Content-Length: 522
  </code></pre>
  
  <p>Even if I try to ignore the routes to <code>~/Content</code> and <code>~/Scripts</code>, these files are still understood as dynamic content:</p>
  
  <pre><code>    public static void RegisterRoutes(RouteCollection routes)
      {
          routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
          routes.IgnoreRoute("{Content}/{*pathInfo}");
          routes.IgnoreRoute("{Scripts}/{*pathInfo}");
  
          routes.MapRoute(
              "Default", // Route name
              "{controller}/{action}/{id}", // URL with parameters
              new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
          );
      }
  </code></pre>
  
  <p>I think this is probably because the web.config line that is needed for MVC but also forces all the request through the ASP.NET pipeline:</p>
  
  <pre><code>&lt;modules runAllManagedModulesForAllRequests="true" /&gt;
  </code></pre>
  
  <p>UPDATE: I have tried to put this setting to false and happens the same.</p>
  
  <p>Is there a way to avoid it? I don't want compression for my dynamic content but I do want it for my static content.</p>
  
  <p>Or is the only way put the files somewhere else?</p>
  
  <p>Cheers.</p>