01 | if (!Request.UserAgent.ToLower().Contains("konqueror")) |
02 | { |
03 | if (Request.Headers["Accept-encoding"] != null && |
04 | Request.Headers["Accept-encoding"].Contains("gzip")) |
05 | { |
06 | Response.Filter = new GZipStream(Response.Filter, |
07 | CompressionMode.Compress, true); |
08 | Response.AppendHeader("Content-encoding", "gzip"); |
09 | } |
10 | else if (Request.Headers["Accept-encoding"] != null && |
11 | Request.Headers["Accept-encoding"].Contains("deflate")) |
12 | { |
13 | Response.Filter = new DeflateStream(Response.Filter, |
14 | CompressionMode.Compress, true); |
15 | Response.AppendHeader("Content-encoding", "deflate"); |
16 | } |
17 | } |
欢迎光临 黑马程序员技术交流社区 (http://bbs.itheima.com/) | 黑马程序员IT技术论坛 X3.2 |