Aspdotnet-Suresh

aspdotnet-suresh offers C#.net articles and tutorials,csharp dot net,asp.net articles and tutorials,VB.NET Articles,Gridview articles,code examples of asp.net 2.0 /3.5,AJAX,SQL Server Articles,examples of .net technologies

Enable Gzip Compression in Asp.net using Web.Config to Improve Website Performance

Jul 16, 2014
Introduction:

Here I will explain how to enable gzip compression in asp.net using web.config file or add gzip compression in asp.net website using web.config file. Gzip compression is used to increase the page performance of website or application by compressing html, css, jquery, JavaScript etc files.

Description:

In previous post I explained Difference between cursor and while loop in sql server, Breadcrumb example in asp.net, how to pass table as parameter to stored procedure, Add Fade in effect to webpage using JQuery and many articles relating to asp.net, JQuery, Ajax etc. Now I will explain how to enable gzip compression in asp.net using web.config file to increase page performance of website.

Gzip compression is mainly used to improve performance of website by compressing project files for that we need to write the code like as shown below in web.config file


<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>

By setting above properties in web.config file automatically it will compress application files and it will help us to improve performance of website.

If you enjoyed this post, please support the blog below. It's FREE!

Get the latest Asp.net, C#.net, VB.NET, jQuery, Plugins & Code Snippets for FREE by subscribing to our Facebook, Twitter, RSS feed, or by email.

subscribe by rss Subscribe by RSS subscribe by email Subscribe by Email

2 comments :

Satyajeet Gopal said...

Hi Suresh..Your posts greatly inspire most of us I believe. Could you please advise if above codes will work in all asp.net application or some attributes need to be customized depending on application. Look forward to your reply. Thanks in advance..Regds. Sat

Lakhani Ghanshyam said...

hiee..! suresh i was tested my website by Yslow addon and this code didn't compression..
please show me right solution.....Thanks in advanced....

Give your Valuable Comments

Other Related Posts

© 2010-2012 Aspdotnet-Suresh.com. All Rights Reserved.
The content is copyrighted to Suresh Dasari and may not be reproduced on other websites without permission from the owner.