Quantcast

ASP.NET 2.0: Whitespace Removal HTTP Module

Get the WebProNews Newsletter:


[ Business]

I’ve written about whitespace removal before, but I think this is the best solution so far.

It is a plug n’ play HTTP module that works simply by adding the class to the App_Code folder.

It uses regular expressions to identify and remove the unnecessary whitespace from the current .aspx web page.

The overhead from this module is almost too insignificant to even measure.

Implementation

Download the WhitespaceModule.cs below and put it in the App_Code folder. Then add this to the web.config.

<httpModules>

   <add type="WhitespaceModule" name="WhitespaceModule"/>

</httpModules>

The cool thing about HTTP modules like this is that you can add them to any ASP.NET project without changing existing code.

You can do even more to reduce the weight of your webpages by using a HTTP compression module that can be implememted the same way as this module.

Download

WhitespaceModule.zip (0,97 KB)

Comments

Add to Del.icio.us | Digg | Reddit | Furl

Bookmark WebProNews:

Mads Kristensen currently works as a Senior Developer at Traceworks located
in Copenhagen, Denmark. Mads graduated from Copenhagen Technical Academy with a multimedia degree in
2003, but has been a professional developer since 2000. His main focus is on ASP.NET but is responsible for Winforms, Windows- and
web services in his daily work as well. A true .NET developer with great passion for the simple solution.

http://www.madskristensen.dk/

ASP.NET 2.0: Whitespace Removal HTTP Module
About Mads Kristensen
Mads Kristensen currently works as a Senior Developer at Traceworks located in Copenhagen, Denmark. Mads graduated from Copenhagen Technical Academy with a multimedia degree in 2003, but has been a professional developer since 2000. His main focus is on ASP.NET but is responsible for Winforms, Windows- and web services in his daily work as well. A true .NET developer with great passion for the simple solution.

http://www.madskristensen.dk/ WebProNews Writer
Top Rated White Papers and Resources
  • Si

    Link to zip file doesn’t work!

  • Join for Access to Our Exclusive Web Tools
  • Sidebar Top
  • Sidebar Middle
  • Sign Up For The Free Newsletter
  • Sidebar Bottom