HttpCompressionModule (HTTP compression for ASP.NET)

An IHttpModule for ASP.NET that provides compression of HTTP Responses。

开源项目:http://code.google.com/p/httpcompress/

本地下载:httpCompress

使用指南

  1. Download and install the HttpModule from http://www.blowery.org/. Simply follow this link and download the binary package.

    If for some reason you can't download it from Blowery.org try here

  2. Extract the package and copy the extracted files into the bin folder of your .Net application.
    blowery.Web.HttpCompress.dll
    blowery.Web.HttpCompress.dll.xml
    ICSharpCode.SharpZipLib.dll
    ICSharpCode.SharpZipLib.dll.xml
  3. Modify your Web.config
    1. Add to the configSections

      <sectionGroup name="blowery.web"> <section name="httpCompress" type="blowery.Web.HttpCompress.SectionHandler, blowery.Web.HttpCompress"/></sectionGroup>
    2. Add to the httpModules section inside system.web (if httpModules section does not exist, create it)
      <httpModules><add name="CompressionModule" type="blowery.Web.HttpCompress.HttpModule, blowery.web.HttpCompress"/></httpModules>
    3. Add to the configuration section
      <blowery.web><httpCompress preferredAlgorithm="deflate" compressionLevel="high">    <excludedMimeTypes>    <add type="image/jpeg"/>    <add type="image/gif"/>    </excludedMimeTypes>    <excludedPaths></excludedPaths></httpCompress></blowery.web>
  4. That's it!

For more information or troubleshooting please refer to http://www.blowery.org/

转自:http://capitalhead.com/articles/enable-http-compression-for-your-aspnet-applications.aspx

参考:http://www.dnnskin.com/KnowledgeBase/DotNetNukeDNNSkins/tabid/500/articleType/ArticleView/articleId/23/categoryId/15/How-to-do-a-Blowery-Compression-DotNetNuke-and-Http-Compression.aspx

http://www.codeproject.com/KB/aspnet/httpcompression.aspx

中文参考:http://space.itpub.net/7383074/viewspace-469865

HTTP Compression with HttpCompress
By  Praveen K Prasad May 02, 2006

This article describes how to enable HTTP compression for ASP.net web applications without having direct access to the server and by using an HttpModule.Introduction

This article is all about how to integrate HTTP compression to your ASP.net web applications with the help of a free httpmodule named httpcompress. It assumes that you've already downloaded the module binaries from the authors site http://www.blowery.org/code/httpcompressionmodule.html.

Http compression is actually a performance optimization technique as documented in the HTTP1.1 protocol standard. It simply means that the Web Server will compress data, and send a compressed page to the browser, which the browser could decompress and display. This reduces the amount of data to be transferred from server to the client and so will speed up process. The speed increase is most noticable over slow connections.

The HttpCompress module is actually an httpmodule that can be plugged into your web application by editing the application configuration and it involves no recompilation of the entire project.

How to achieve it

The module we're going to use comes as two dll files

  • blowery.Web.HttpCompress.dll
  • ICSharpCode.SharpZipLib.dll

After obtaining the files, please follow the steps below

  1. Place the files inside the 'bin' folder of your application.
  2. Open the application's configuration file, "web.config" and add the following entries to it.
  3. Locate the tag <configuration> , it is there in the starting you needn't require to search it out. Just below it add the segment.

    <configSections>

    <sectionGroup name="blowery.web">

    <section name="httpCompress" type="blowery.Web.HttpCompress.SectionHandler, blowery.Web.HttpCompress"/>

    </sectionGroup>

    </configSections>

    <blowery.web>

    <httpCompress preferredAlgorithm="gzip" compressionLevel="high">

    <excludedMimeTypes>

    <add type="image/jpeg"/>

    <add type="image/png"/>

    <add type="image/gif"/>

    </excludedMimeTypes>

    <excludedPaths>

    <add path="NoCompress.aspx"/>

    </excludedPaths>

    </httpCompress>

    </blowery.web>

    This describes a new configSection named <blowery.web> and later this <blowery.web> section is configured. It contains a subsection <httpCompress> thet have to major attributes named, preferredAlgorithm and compressionLevel . preferredAlgorithm specifies which compression algorith is to be used and supported values are gzip/deflate/default. The compressionLevel attribute specifies the amount of comression and the possible values are high/normal/low

    The next section is excludedMimeTypes that specifies which MIME types are to be excluded from compression(You'll not benefit from compressing a jpg/gif image which is already compressed). You may add as many number of MIME types and they will not b compressed by HttpCompress while serving

    Then comes the excludedPaths section that allows you to exclude a specific path from being compressed.The example segment shows a page Nocompress.aspx being excluded.

  4. Plug-in the module into your application by adding the following lines just below the <system.web> section or anywhere inside it.

    <httpModules>

    <add name="CompressionModule" type="blowery.Web.HttpCompress.HttpModule, blowery.web.HttpCompress"/>

    </httpModules>

    This registers the http module with the application instance and it works as a filter for response to the client without directly sending the response to the client, HttpCompress compresses it and sends to the client.

NB:Its not necessary to use compression with your app by using an http module, if the hosted server already performs compression. Client browsers need to support compression for this to work as specified by "Accept-Encoding" in their request.

转自:http://www.c-sharpcorner.com/UploadFile/Ihelpable/httpcompression05022006094806AM/httpcompression.aspx?ArticleID=b0c4a586-97b4-4fbd-a95a-8b1200f0e068

使用blowery.Web.HttpCompress.dll对aspx压缩相关推荐

  1. WEB高性能开发:HTML压缩

    WEB高性能开发:HTML压缩 [日期:2011-01-09] 来源:     作者: [字体:大 中 小] 上一篇随笔中网友 skyaspnet 问我如何压缩HTML,当时回答是推荐他使用gzip, ...

  2. C#操作IIS站点 Microsoft.Web.Administration.dll

    利用IIS7自带类库管理IIS现在变的更强大更方便,而完全可以不需要用DirecotryEntry这个类了(网上很多.net管理iis6.0的文章都用到了DirecotryEntry这个类 ),Mic ...

  3. VS2010小Bug:找不到System.Web.Extensions.dll引用

    用上VS 2010的日子,快乐并痛着... 今天本来是想写这篇随笔的,却在处理朝阳无限提交的新模板的CSS时,一打开CSS文件,VS2010就崩溃,于是发现了VS2010的另一个Bug. 这个VS20 ...

  4. ASP.net 的URL路由选择(System.Web.Routing.dll)

    System.Web.Routing是.net 3.5sp1中新增的一个dll,用它提拱的类可以很方便的实现url的映射,在asp.net WebFrom的编程中可以使客户端请求的URL变得更加的&q ...

  5. web性能优化--用gzip压缩资源文件

    #一.gzip压缩技术 gzip(GNU- ZIP)是一种压缩技术.经过gzip压缩后页面大小可以变为原来的30%甚至更小,这样,用户浏览页面的时候速度会快得多.gzip的压缩页面需要浏览器和服务器双 ...

  6. java web配置dll文件_JavaWeb项目中dll文件动态加载方法解析(详细步骤)

    相信很多做Java的朋友都有过用Java调用JNI实现调用C或C++方法的经历,那么Java Web中又如何实现DLL/SO文件的动态加载方法呢.今天就给大家带来一篇JAVA Web项目中DLL/SO ...

  7. Web使用HarmonyOS字体的压缩方案

    HarmonyOS 字体 https://developer.harmonyos.com/cn/docs/design/font-0000001157868583 通过研究用户在不同场景下对多终端设备 ...

  8. web中gzip,deflate的压缩与解压

    一,对发送请求进行gzip,deflate压缩 1:gzip的情况 Java代码   Sring url = "http://localhost/save"; PostMethod ...

  9. java web 实现多个文件压缩下载

    文件下载时,我们可能需要一次下载多个文件.批量下载文件时,需要将多个文件打包为zip,然后再下载.实现思路有两种:一是将所有文件先打包压缩为一个文件,然后下载这个压缩包,二是一边压缩一边下载,将多个文 ...

最新文章

  1. CLLocationCoordinate2D 用法 和一个最隐蔽的错误
  2. 标准粒子群算法(PSO)及其Matlab程序和常见改进算法
  3. 年龄计算、工作表合并、高级筛选(三)
  4. Docker容器的管理
  5. 不重复地输出数(信息学奥赛一本通-T1245)
  6. 中国成全球第二AI医疗交易国,上半年AI制药融资数等于去年全年 | 报告
  7. Android开发里的自定义View的实现
  8. android手机视频,安卓手机视频加密软件
  9. 实现Matlab将16进制数据存储到txt文件
  10. MCS-51单片机的硬件结构
  11. 怎么用spss做冗余分析_SPSS在线_SPSSAU_SPSS典型相关分析
  12. Python 实现集成经验模态分解(EEMD)
  13. 什么是T1 mapping?
  14. 量化交易系统之python+mysql(二)
  15. 目标检测00-10:mmdetection(Foveabox为例)-源码无死角解析(3)-头部网络bbox_head-训练过程
  16. js 时区对应的时间转换
  17. 接口测试用例设计:常见问题和风险
  18. Mac截图很大很怎么变小?
  19. 上海远丰:打破双11魔咒,让企业电商两条腿走路
  20. WPS 关闭自动更新和热点新闻推荐

热门文章

  1. T-SQL中default值的使用
  2. 《 自动化测试最佳实践:来自全球的经典自动化测试案例解析》一一2.4 开发内部测试工具...
  3. java内存模型与volatile变量与Atomic的compareAndSet
  4. CSS3 过渡(Transition)
  5. Android事件总线还能怎么玩?
  6. ITU-T Technical Paper: IP网络测量模型
  7. 转 java学习笔记(必看经典)
  8. vt Hypervisor Framework
  9. 重磅!2017年度互联网转型企业TOP5发布 | 2017极客大奖年度评选
  10. 关于ios中编译ffmpeg0.9.2库