I want to compress my web application with Gzip and I am using following class
compression filter
public class CompressFilter : Acti
Check your local IIS if Compression is properly configured. Please refer the following link to properly configure IIS for HTTP Compression.
http://www.iis.net/configreference/system.webserver/httpcompression
If you can't control IIS, just add this to your Global.ASCX. tested on Android, iPhone, and most PC browsers.
protected void Application_BeginRequest(object sender, EventArgs e)
{
// Implement HTTP compression
HttpApplication app = (HttpApplication)sender;
// Retrieve accepted encodings
string encodings = app.Request.Headers.Get("Accept-Encoding");
if (encodings != null)
{
// Check the browser accepts deflate or gzip (deflate takes preference)
encodings = encodings.ToLower();
if (encodings.Contains("deflate"))
{
app.Response.Filter = new DeflateStream(app.Response.Filter, CompressionMode.Compress);
app.Response.AppendHeader("Content-Encoding", "deflate");
}
else if (encodings.Contains("gzip"))
{
app.Response.Filter = new GZipStream(app.Response.Filter, CompressionMode.Compress);
app.Response.AppendHeader("Content-Encoding", "gzip");
}
}
}