When it comes to optimizing the web there are many options available. I have talked about several of them before like image compression, using sprites, CDN’s, etc. Today I am going to talk about another option which is called GZIP. The idea is simple. If you have a file on a server and want to send it to a local computer then most of the time it is faster to have the server compress the file, send it and then have the local machine uncompress it. However; in order to get this to work you need to tell the local computer that you are sending a compressed response. Since all current browsers can handle this type of compression it makes it sense to enable this on your site.
Also another issue that has been removed since asp.net 4.0 is that enabling this on the server usually meant that you had to have admin rights to the server in order to configure IIS to handle this. This is no longer the case when it comes to using GZIP on a .NET 4.0 application. You can now add it to the <system.webServer> node under the web.config file.
[code language=”XML”]
<!–Runs Gzip–>
<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"/>
[/code]
This is just an example of what the web.config might look like. To better understand what types of files should be under dynamicTypes vs. StaticTypes please read the following short explanation from http://www.iis.net/configreference/system.webserver/httpcompression
•Static Compression:
You should use static compression with files that do not typically change, such as HTML files (*.html, *.htm), text files (*.txt), Microsoft Office documents (*.doc, *.xls, *.ppt), etc. The size of these files can be reduced through compression, which reduces download times for client requests and reduces bandwidth on the server.
Note: Image files such as *.png and *.png files are also static files, but typically they do not benefit from HTTP compression because these image files are already compressed.
•Dynamic Compression:
Unlike static compression, IIS 7 performs dynamic compression each time a client requests the content, but the compressed version is not cached to disk. This change is made because of the primary difference between static and dynamic content. Static content does not change. However, dynamic content is typically content that is created by an application and therefore changes often, such as Active Server Pages (ASP) or ASP.NET content. Since dynamic content should change often, IIS 7 does not cache it.
Looking for quality web hosting? Look no further than Arvixe Web Hosting!