通过Filter对asp.net页面进行GZip压缩
if (!Request.UserAgent.ToLower().Contains("konqueror")) { if (Request.Headers["Accept-encoding"] != null && Request.Headers["Accept-encoding"].Contains("gzip")) { Response.Filter = new GZipStream(Response.Filter, CompressionMode.Compress, true); Response.AppendHeader("Content-encoding", "gzip"); } else if (Request.Headers["Accept-encoding"] != null && Request.Headers["Accept-encoding"].Contains("deflate")) { Response.Filter = new DeflateStream(Response.Filter, CompressionMode.Compress, true); Response.AppendHeader("Content-encoding", "deflate"); } }