title: Firefox issues with Compression Filter Attribute in ASP.Net MVC
body: <p>In ASP.Net MVC 2 I am using the following compression filter and, in Chrome it works fine but in Firefox 3.3.6 it returns weird characters.</p>
  
  <pre><code>public class CompressAttribute : ActionFilterAttribute
  {
      public override void OnActionExecuting(ActionExecutingContext filterContext)
      {
          //get request and response 
          var request = filterContext.HttpContext.Request;
          var response = filterContext.HttpContext.Response;
  
          //get requested encoding 
          if (!string.IsNullOrEmpty(request.Headers["Accept-Encoding"]))
          {
              string enc = request.Headers["Accept-Encoding"].ToUpperInvariant();
  
              //preferred: gzip or wildcard 
              if (enc.Contains("GZIP") || enc.Contains("*"))
              {
                  response.AppendHeader("Content-encoding", "gzip");
                  response.Filter = new GZipStream(response.Filter, CompressionMode.Compress);
              }
  
              //deflate 
              else if (enc.Contains("DEFLATE"))
              {
                  response.AppendHeader("Content-encoding", "deflate");
                  response.Filter = new DeflateStream(response.Filter, CompressionMode.Compress);
              }
          }
          base.OnActionExecuting(filterContext);
      }
  }
  </code></pre>
  
  <p>Here are a sample of the characters displayed by Firefox:</p>
  
  <p>��������<code>I�%&amp;/m�{J�J��t��</code>$ؐ@�����iG#)�*��eVe]f@�흼��{���{��;�N'���?\fdl��J�ɞ!���?</p>
  
  <p>What is the cause?</p>