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


Comments are closed