The compressionmodule compression module compresses all resources requested by the ASPX page and compression modules that support powerful custom functions, like httpcompress6.0, you can customize the types of resources you want to compress and do not compress those types of resources. You can also define whether to compress the specified page or not to compress the specified page, in addition, the cache Resource function and the powerful function of the specified compressed directory are enabled. In addition, there will be no bug like httpcompress6.0 that the axd file is invalid, this compression module can perfectly support various Ajax frameworks !!
Advantages: open source code, powerful custom functions, ability to compress a variety of resources, and perfect support for various Ajax frameworks!
Disadvantage: complicated use. Only ASP. net2.0 or later is supported!
To sum up, various compression modules can optimize pages. However, since the compression process occurs at one end of the server, enabling these compression will consume a little server resources, however, in general, the compression only occurs when the client accesses the page for the first time. Because the browser caches the page and resource relationships, the server resources will not be used for compression when the access is refreshed again, therefore, for developers who have a huge website page size, enabling the compression function is definitely worth some money. After all, the page size is smaller and loading will be faster!
Use
First, put DC. Web. httpcompress. dll in the bin directory of the project, and add and modify the Web. config of the Project as follows:
Code
1 <configsections>
2 <sectiongroup name = "dcweb">
3 <section name = "httpcompress" type = "DC. Web. httpcompress. configuration,
4 DC. Web. httpcompress "/>
5 </sectiongroup>
6 </configsections>
7
8 <dcweb>
9 10 <! -- Set whether to enable cachefiles and specify the cache directory. If this line of configuration is deleted, the default value is false (no cache is enabled). -->
11 <cachesetaskcachefiles = "true" Path = "cache"/>
12 <! -- Set jspath and csspath. If this line of configuration is deleted, the default value will be used. -->
13 <pathsettings jspath = "JavaScript" csspath = "CSS"/>
14 <! -- Set the type of resources to be compressed. Here, only HTML is compressed, that is, other resources except the ASPX page (including all axd resources) are not compressed. For example, if GIF is to be compressed, add <add mime = "image/GIF"/> -->
15 <shortdedmimetypes>
16 <add mime = "text/html"/>
17 </includedmimetypes>
18 <! -- Set the type of resources not compressed, please use:
19 <excludedmimetypes>
20 <add mime = "text/html"/>
21 </excludedmimetypes>
22 Note: you only need to configure excludedmimetypes and includedmimetypes. If you configure them like above, it indicates that other resources except HTML resources will be compressed.
23 -->
24 <excludedpaths>
25 <! -- Set the page path for which compression is not enabled. The default. aspx page in the nocompress directory is set below. The compression function is not enabled for other pages. -->
26 <add Path = "~ /Nocompress/default. aspx "/>
27 </excludedpaths>
28 29 </dcweb>
30
31 <! -- The JS. axd and CSS. axd must be enabled to allow JavaScript and CSS
32 Compression -->
33 34 <! -- If you do not need this function, you can delete this configuration section. -->
35 <add verb = "*" Path = "Js. axd, CSS. axd"
36 type = "DC. Web. httpcompress. compressionhandler, DC. Web. httpcompress"/>
37 38 <! -- The compression module must be enabled for the webresource. axd to be
39 compressed -->
40 41 <Add name = "scriptmodule" type = "system. Web. Handlers. scriptmodule,
42 system. Web. Extensions, version = 1.0.61025.0, culture = neutral,
43 publickeytoken = 31bf3856ad364e35 "/>
44 <! -- Set the parameters for enabling the compression module -->
45 <Add name = "httpcompressmodule"
46 type = "DC. Web. httpcompress. httpmodule, DC. Web. httpcompress"/>
47 48
49
After configuration, the compression module will work normally!
TIPS: If Web. config is configured
<Cachesetaskcachefiles = "true" Path = "cache"/>
The cache directory must exist in the project. Otherwise, an error will occur. If the project does not want to add this directory, you only need to delete this configuration section.
Finally provide source code download http://download.csdn.net/source/2759905