HttpCompressionModule (HTTP compression for ASP.NET)
An IHttpModule for ASP.NET that provides compression of HTTP Responses。
开源项目:http://code.google.com/p/httpcompress/
本地下载:httpCompress
使用指南
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 hereExtract the package and copy the extracted files into the bin folder of your .Net application.blowery.Web.HttpCompress.dllblowery.Web.HttpCompress.dll.xmlICSharpCode.SharpZipLib.dllICSharpCode.SharpZipLib.dll.xmlModify your Web.config Add to the configSections <sectionGroup name="blowery.web"> <section name="httpCompress" type="blowery.Web.HttpCompress.SectionHandler, blowery.Web.HttpCompress"/></sectionGroup>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>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>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.dllAfter obtaining the files, please follow the steps below
Place the files inside the 'bin' folder of your application. Open the application's configuration file, "web.config" and add the following entries to it.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/lowThe 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. 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
转载于:https://www.cnblogs.com/wuhenke/archive/2010/05/17/1737781.html