|
|
|
|
HTTP Compression with HttpCompress
By
Praveen K Prasad November 27, 2006
This article describes how to enable HTTP compression for ASP.net web applications without having direct access to the server and by using an HttpModule.
|
|
Technologies:
.NET 1.0/1.1, ASP.NET 1.0,Visual Basic .NET |
|
Total downloads : |
|
|
Total page views : |
6108 |
|
Rating : |
|
0/5 |
|
This article has been rated : |
0 times |
|
|
Similar ArticlesMost ReadTop RatedLatest
|
|
Related EbooksTop Videos
|
|
|
Description
|
|
The Complete Visual C# Programmer's Guide, written by the authors of C# Corner, covers most of the major components that make up C# and the .NETenvironment including Windows Forms, ADO.NET, GDI+, Web Services, and Security. The book is geared toward the beginner to intermediate programmers.
|
|
|
|
|
|
|
|
|
|
|
|
|
Introduction
This article is all about how to integrate HTTP compression to your ASP.net web applications with the help of a free httpmodule named httpcompress. It assumes that you've already downloaded the module binaries from the authors site http://www.blowery.org/code/httpcompressionmodule.html.
Http compression is actually a performance optimization technique as documented in the HTTP1.1 protocol standard. It simply means that the Web Server will compress data, and send a compressed page to the browser, which the browser could decompress and display. This reduces the amount of data to be transferred from server to the client and so will speed up process. The speed increase is most noticable over slow connections.
The HttpCompress module is actually an httpmodule that can be plugged into your web application by editing the application configuration and it involves no recompilation of the entire project.
How to achieve it
The module we're going to use comes as two dll files
- blowery.Web.HttpCompress.dll
- ICSharpCode.SharpZipLib.dll
After obtaining the files, please follow the steps below
- Place the files inside the 'bin' folder of your application.
- Open the application's configuration file, "web.config" and add the following entries to it.
- Locate the tag <configuration> , it is there in the starting you needn't require to search it out. Just below it add the segment.
<configSections>
<sectionGroup name="blowery.web">
<section name="httpCompress" type="blowery.Web.HttpCompress.SectionHandler, blowery.Web.HttpCompress"/>
</sectionGroup>
</configSections>
<blowery.web>
<httpCompress preferredAlgorithm="gzip" compressionLevel="high">
<excludedMimeTypes>
<add type="image/jpeg"/>
<add type="image/png"/>
<add type="image/gif"/>
</excludedMimeTypes>
<excludedPaths>
<add path="NoCompress.aspx"/>
</excludedPaths>
</httpCompress>
</blowery.web> This describes a new configSection named <blowery.web> and later this <blowery.web> section is configured. It contains a subsection <httpCompress> thet have to major attributes named, preferredAlgorithm and compressionLevel . preferredAlgorithm specifies which compression algorith is to be used and supported values are gzip/deflate/default. The compressionLevel attribute specifies the amount of comression and the possible values are high/normal/low
The next section is excludedMimeTypes that specifies which MIME types are to be excluded from compression(You'll not benefit from compressing a jpg/gif image which is already compressed). You may add as many number of MIME types and they will not b compressed by HttpCompress while serving
Then comes the excludedPaths section that allows you to exclude a specific path from being compressed.The example segment shows a page Nocompress.aspx being excluded.
- Plug-in the module into your application by adding the following lines just below the <system.web> section or anywhere inside it.
<httpModules>
<add name="CompressionModule" type="blowery.Web.HttpCompress.HttpModule, blowery.web.HttpCompress"/>
</httpModules> This registers the http module with the application instance and it works as a filter for response to the client without directly sending the response to the client, HttpCompress compresses it and sends to the client.
NB:Its not necessary to use compression with your app by using an http module, if the hosted server already performs compression. Client browsers need to support compression for this to work as specified by "Accept-Encoding" in their request.
NOTE: THIS ARTICLE IS CONVERTED FROM C# TO VB.NET USING A CONVERSION TOOL. ORIGINAL ARTICLE CAN BE FOUND ON C# CORNER (http://www.c-sharpcorner.com/).
|
|
|
Login
to add your contents and source code to this article
|
|
|
|
|
|
|
|
|
|
|
|
Praveen K Prasad
An MCAD on the .net platform with more then 5 years of professional experience. Worked on .net platforms since its beta stage. Current;ly working with Vanilla Networks Pty Ltd, an Australian Software Company in the Technopark, Trivandrum, Kerala
|
|
|
|
|
|
|
|
|
C# Consulting is founded in 2002 by the founders of C# Corner. Unlike a traditional
consulting company, our consultants are well-known experts in .NET and many of them
are MVPs, authors, and trainers. We specialize in Microsoft .NET development and
utilize Agile Development and Extreme Programming practices to provide fast pace
quick turnaround results. Our software development model is a mix of Agile Development,
traditional SDLC, and Waterfall models.
|
|
Click here to learn more about C# Consulting. |
|
|
|
|
|
|
|
Introducing MaxV - one click. infinite control. Hyper-V Hosting from MaximumASP.
Finally – a virtual platform that delivers next-generation Windows Server 2008 Hyper-V virtualization technology from a managed hosting partner you can truly depend on. Visit www.maximumasp.com/max for a FREE 30 day trial. Hurry offer ends soon.
Climb aboard the MaxV platform and take advantage of High Availability, Intelligent Monitoring, Recurrent Backups, and Scalability – with no hassle or hidden fees.
As a managed hosting partner focused solely on Microsoft technologies since 2000, MaximumASP is uniquely qualified to provide the superior support that our business is built on. Unparalleled expertise with Microsoft technologies lead to working directly with Microsoft as first to offer IIS 7 and SQL 2008 betas in a hosted environment; partnering in the Go Live Program for Hyper-V; and product co-launches built on WS 2008 with Hyper-V technology.
|
Dynamic PDF
ceTE software specializes in components for dynamic PDF generation and manipulation. The DynamicPDF™ product line allows you to dynamically generate PDF documents, merge PDF documents and new content to existing PDF documents from within your applications.
|
Boost the performance of your .NET applications
“ANTS Profiler took us straight to the specific areas of our code which were the cause of our performance issues." Terry Phillips, Sr. Developer, Harley-Davidson Dealer Systems. Download your free trial of ANTS Profiler.
|
Go.NET
Build custom interactive diagrams, network, workflow editors, flowcharts, or software design tools. Includes many predefined kinds of nodes, links, and basic shapes. Supports layers, scrolling, zooming, selection, drag-and-drop, clipboard, in-place editing, tooltips, grids, printing, overview window, palette. 100% implemented in C# as a managed .NET Control. Document/View/Tool architecture with many properties&events. Optional automatic layout.
|
Dundas Software
Dundas Chart for .NET is the most advanced .NET charting package available today. With an extremely complete feature set, elegant architecture and easy implementation, Dundas Chart can quickly add advanced Charting functionality to enhance and transform ASP.NET and Windows Forms applications. Whether you are implementing charting into internal projects, or building applications for clients, Dundas Chart offers advanced technology and advanced results to get the most out of data.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|