2012年11月7日

HttpWebRequest开启gzip压缩

摘要: 在用HttpWebRequest对象时,一般我们都没有开启gzip压缩,如果服务端返回的数据比较大,这是我们需要开启gzip压缩,怎么开启了?1.给HttpWebRequest对象,添加如下Header request.Headers.Add("Accept-Encoding", "gzip");2.对接收到的流进行解码private string GetResponseBody(HttpWebResponse response){string responseBody = string.Empty;if (response.ContentEncodin 阅读全文

posted @ 2012-11-07 21:21 dz45693 阅读(2771) 评论(0) 推荐(1) 编辑

OutputCacheProvider OutputCache的一点点认识

摘要: 在asp.net4.0后我们可以实现自己的OutputCacheProvider来控制缓存的位置了,但是我发现很多人多OutputCacheProvider的调用并不是很清楚。首先我们要知道缓存是在哪里注册的。答案是OutputCacheModulevoid IHttpModule.Init(HttpApplication app){ if (RuntimeConfig.GetAppConfig().OutputCache.EnableOutputCache) { app.ResolveRequestCache += new EventHandler(this.OnEnter); ... 阅读全文

posted @ 2012-11-07 15:51 dz45693 阅读(3434) 评论(3) 推荐(1) 编辑

导航