GZIP compression in asp.net using web.confg

GZIP compression is a technique that compresses all web pages on the web server before the page is sent to the browser so that it increases the loading speed of the page and save the bandwidth.
GZIP compression is recommended for all types of text files likes:
.html, .aspx, .php, .js, .css and so on but GZIP compression does not recommended for all types of non-text files likes graphic files.


We can achieve this to many ways in asp.net but simplest way to achieve this to implement in web.confg in asp.net

Source code:-
  

<system.webServer>
   
      <httpCompression directory="%SystemDrive%\inetpub\
temp\IIS Temporary Compressed Files">
    <scheme name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll"/>
    <dynamicTypes>
      <add mimeType="text/*" enabled="true"/>
      <add mimeType="message/*" enabled="true"/>
      <add mimeType="application/javascript" enabled="true"/>
      <add mimeType="*/*" enabled="false"/>

    </dynamicTypes>
    <staticTypes>
      <add mimeType="text/*" enabled="true"/>
      <add mimeType="message/*" enabled="true"/>
      <add mimeType="application/javascript" enabled="true"/>
      <add mimeType="*/*" enabled="false"/>
    </staticTypes>
  </httpCompression>

  <urlCompression doStaticCompression="true" doDynamicCompression="true"/>

  </system.webServer
GZIP compression in asp.net using web.confg GZIP compression in asp.net using web.confg Reviewed by NEERAJ SRIVASTAVA on 11:17:00 AM Rating: 5

No comments:

Powered by Blogger.