Using gzip to compress page files not only reduces site traffic, reduces server load, but also increases the speed at which users open pages.
1. can be set in the IIS server, unfortunately there is no file extension like http://shenzhen.yekua.cn/fangwuchuzu/ after the URL is rewritten
Unable to enable gzip Compression
2. In Asp.netProgramCan be set in the base class
Public class basepage: system. Web. UI. Page
{
Public basepage ()
{
If (httpcontext. Current. Request. headers ["Accept-encoding"]. tolower (). indexof ("gzip ")! =-1)
{
Httpcontext. Current. response. Filter = new gzipstream (httpcontext. Current. response. filter, compressionmode. Compress );
Httpcontext. Current. response. appendheader ("content-encoding", "gzip"); // If the browser is not set to garbled
}
}
}
3.Iis6.0EnableGzip Compression
① Open website properties in IIS, switch to the "service" tab, and select "compress Application Files" and "compress static files ":
② Right-click "Web Service extension" and choose "Add a new Web Service extension". The settings are as follows:
③ Run "iisreset/restart" in the command line to restart the IIS service;
Configure the file type for gzip Compression
① Run "iisreset/stop" on the command line to stop the IIS service (metabase. XML is read-only when it is enabled );
② Open c: \ windows \ system32 \ inetsrv \ metabase. xml and find:
Reference content <iiscompressionscheme location = "/lm/w3svc/filters/compression/gzip"
Hccompressiondll = "% WINDIR % \ system32 \ inetsrv \ gzip. dll"
Hccreateflags = "1"
Hcdodynamiccompression = "true"
Hcdoondemandcompression = "true"
Hcdostaticcompression = "true"
Hcdynamiccompressionlevel = "0"
Hcfileextensions = "htm
Html
TXT"
Hcondemandcomplevel = "10"
Hcpriority = "1"
Hcscriptfileextensions = "ASP
DLL
EXE"
>
</Iiscompressionscheme>
The hcfileextensions attribute is the static file extension to enable gzip compression, and the hcscriptfileextensions attribute is the dynamic file extension to enable gzip compression, which can be set and saved as needed;
③ Run "iisreset/start" on the command line to enable the IIS service;