Page title
  Login

 

 

DotNetNuke Sponsor


MyDNN Updates
Thursday, May 17, 2012
MyDNN Updates
Jan 23

Written by: sherritp
1/23/2006 10:14 PM  RssIcon

Today I upgraded a DotNetNuke installation and added compression (soon I'll get around to updating this install, too!).  Server-side compression will tell the web server to try to send compressed data to the web browser instead of the full HTML text of each page.  This can be quite a savings with DotNetNuke as there are several stylesheets and javascripts to download in addition to a rather large page payload (enhanced with viewstate at the bottom).  Fortunately, text (HTML, CSS, and Javascript in this case) all compress nicely, usually between 50% and 80%.

To enable compression on your DotNetNuke site (DNN3.2.2 in my case) you have to make one change to your /bin folder and three changes to your web.config.

First, download the Blowery HTTPCompression module (pick the Version 6, binary only version).  Blowery stands for Ben Lowery--a nice guy who has generously donated something valuable to the asp.net community--read his blog.  Upload the following files to your DotNetNuke /bin directory on your server:

  • ICSharpCode.SharpZipLib.xml
  • ICSharpCode.SharpZipLib.dll
  • blowery.Web.HttpCompress.xml
  • blowery.Web.HttpCompress.dll

Mr. Lowery has a very generous license for using this code--just don't claim that it is yours and give credit when possible. So, if you've downloaded the .zip and uploaded the 4 files do your DNN install, you've got the first part of this licked!

Now, you need to make three changes to your web.config.  First, add the following XML to the top part of your web.config file.  Find </sectionGroup> and add these three lines immediately following:

    <sectionGroup name="blowery.web">
      <section name="httpCompress" type="blowery.Web.HttpCompress.SectionHandler, blowery.Web.HttpCompress"/>
    </sectionGroup>

Next, find the </httpModules> section (it is inside the system.web tag).  Insert the following line before the </httpModules>:

      <add name="CompressionModule" type="blowery.Web.HttpCompress.HttpModule, blowery.web.HttpCompress"/>

Finally, add this section right after </system.webin my config it is just before <memberrolesprototype>:
<blowery.web>
  <httpCompress preferredAlgorithm="gzip" compressionLevel="high">
    <excludedMimeTypes>
      <add type="image/png" />
      <add type="image/jpeg" />
      <add type="image/gif" />
      <add type="application/zip" />
      <add type="application/x-zip-compressed" />
      <add type="application/x-gzip-compressed" />
      <add type="application/x-compressed" />
      <add type="application/octet-stream" />
      <add type="application/pdf" />
    </excludedMimeTypes>
    <excludedPaths>
      <add path="Install/" />
    </excludedPaths>
  </httpCompress>
</blowery.web>

Save your web.config file to your site and browse to your home page.  After DNN loads the new files, you should notice that each page loads faster than before.

One note of caution before I'm done, please disable (comment or remove) the httpmodule (the <add name="...) before performing an upgrade/update.  Compression and the upgrade process do not work well together, although uploading new modules does seem to work fine.

Enjoy!

Tags:
Categories:
Location: Blogs Parent Separator DNN Notes

1 comment(s) so far...


Gravatar

.NET not workong that well 3.5

I realy like this information, and it was very helpful! - but for me .NET 3.5 in causes problem and not rendered correctly

By Roy on   10/11/2009 4:29 AM

Your name:
Gravatar Preview
Your email:
(Optional) Email used only to show Gravatar.
Your website:
Title:
Comment:
Security Code
CAPTCHA image
Enter the code shown above in the box below
Add Comment   Cancel 
Terms Of Use | in8 - The good stuff's inside | Privacy Statement
Copyright (c) 2012 mydnn.org