Well, I got gzip working, but there are issues with IE. (works fine with FF and Chrome)
Message: ASP.NET Ajax client-side framework failed to load. (and many other js related errors)
How can I prevent gzip compression on ie browsers ??
Other people who had similar issues enabled compression in IIS and that seems to solve the issue, but I can’t do this on my discount machine…
This is what I use:
HttpApplication app = (HttpApplication)sender;
string acceptEncoding = app.Request.Headers["Accept-Encoding"];
Stream prevUncompressedStream = app.Response.Filter;
if (acceptEncoding != null && acceptEncoding.Length != 0)
{
acceptEncoding = acceptEncoding.ToLower();
if (acceptEncoding.Contains("gzip"))
{
app.Response.Filter = new GZipStream(prevUncompressedStream, CompressionMode.Compress);
app.Response.AppendHeader("Content-Encoding", "gzip");
}
else if (acceptEncoding.Contains("deflate"))
{
// defalte
app.Response.Filter = new DeflateStream(prevUncompressedStream, CompressionMode.Compress);
app.Response.AppendHeader("Content-Encoding", "deflate");
}
}
Try to compress GZip only the files that ends on aspx and left WebResource that contains the Javascript that you have problem, to compress by iis him self.
This will solve your problem.