zoukankan      html  css  js  c++  java
  • 使用blowery.Web.HttpCompress.dll对aspx压缩

    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

    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

  • 相关阅读:
    Vue动画操作
    js this
    flask 操作mysql的两种方式-sqlalchemy操作
    flask 操作mysql的两种方式-sql操作
    ansible批量加用户
    使用 WTForms 进行表单验证的例子
    flask开发用户管理系统wtf版
    [转]Python格式化输出
    scrapy中response.body 与 response.text区别
    flask开发表单
  • 原文地址:https://www.cnblogs.com/wuhenke/p/1737781.html
Copyright © 2011-2022 走看看