ASP. NET GZIP compression enabled

Source: Internet
Author: User

Gzip compression uses a compression algorithm that compresses the content of the Web page, reducing the page size. The use of GIZP compression reduces the bandwidth of the server and improves the speed of Web page opening. Look underneath, I found one. The gzip compression scheme is enabled in ASP.

First, we need to download DC.Web.HttpCompress.dll and reference it to our ASP. Next in the Web. config simple configuration, you can achieve gzip compression, need to configure the following places:

<sectiongroup name="dcweb">        <section name="httpcompress  " type="DC. WEB.HTTPCOMPRESS.CONFIGURATION,DC. Web.httpcompress"/>    </sectionGroup></configSections>
<!--configuring gzip compression--><dcweb> "GZip"> <!--set Jspath and Csspath, if you delete this line of configuration, you will use the default value--<pathsettings jspath="JavaScript"Csspath="CSS"/> <IncludedMimeTypes> <add mime="text/html"/> <add mime="Image/gif"/> <add mime="Image/jpeg"/> <add mime="Text/css"/> <add mime="Application/x-javascript"/> </IncludedMimeTypes> <!--To configure what type of resource is not compressed, use:<ExcludedMimeTypes> <add mime="text/html"/> </ExcludedMimeTypes>Note: Excludedmimetypes and includedmimetypes only need to be configured one, if you configure Excludemimetypes as above, it means that other resources are compressed except the HTML type.-<!--<ExcludedPaths>set a page path that does not have compression enabled, and the Default.aspx page under the Nocompress directory will not have compression enabled, but other pages would normally have compression enabled<add path="~/nocompress/default.aspx"/> </ExcludedPaths>--> </HttpCompress></DCWeb><!--gzip compression ended-
<add name= "Httpcompressmodule" type= "DC. WEB.HTTPCOMPRESS.HTTPMODULE,DC. Web.httpcompress "/>
</system.web>

Here we have implemented the ASP. NET gzip compression, below look at my local test results, you can use Google Chrome browser to see if gzip compression is enabled, use Ctrl+shift+j to open, click Resources to view files, as follows:

Before you enable gzip compression

After gzip compression is enabled

ASP. NET GZIP compression enabled

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.