Wife/Girlfriend/Sister?
Pepper Spray &
Stun Gun Specials!
KEEP THEM SAFE.
 CoverYourASP --> ASP Render blocks --> Part 2

Free membership

Join in the fun! Sign in
Member Services

Site navigation
Download the entire site!
Search my articles
Free Magazines
Browse the directory

Send me feedback
Buy my boxer shorts

Recommend this page
Printer-friendly page

Resources I recommend
Link to my site
Advertising slashed!
About your privacy
Legal stuff
Site statistics
60 active users
1246 visitors today
2433 pages today
how is this done?
Tools I use

CoverYourASP
Copyright © 1999-2010 James Shaw.
All rights reserved.

ASP.NET Blog
RSS submissions
E-commerce

Now open source with SourceForge!

Wasting Bandwidth

You see how the file above is nicely formatted - the <title> tag is indented from the <head> tag? You need to do that when you're coding to make the code easily readable, and hence maintainable.

But you're punishing your users unnecessarily! They have to download your extra line feeds and tabs, when their browser could care less that they are there. The file below renders exactly the same:

<%@ Language=JavaScript %>
<html><head><title>My page</title></head><body>We're in "HTML mode" here...
<%
   var sScript = Request.ServerVariables ( "SCRIPT_NAME" );

   Response.Write ( '<p>I am called ' + sScript + '<p>' );
%>
...and here.</body></html>

So, the user is now happier because your page loads faster. If you don't think this matters much do a View/Source on some major sites and see the extra baggage they send out. Remove the HTML comments and the extra spaces/tabs and you'll be surprised how much quicker they download.

I did this exercise on a page generated with FrontPage. It started out as a 40k file - that's a sizeable page to download at 28.8kb. I removed the indentation (which were all spaces) and the HTML comments and the page reduced to 3k. The browser didn't render anything differently, just 10 times quicker!

Part 3: Readability...

Featured sponsor
My favorite resources

Tiki Statues - Tiki Masks - Tiki Totems


CoverYourASP Mugs, T-shirts, caps - even Boxer shorts...
I don't make a penny from these, but they're a lot of fun! Don't you need a new mouse mat?


I share my content

Supporting ASPRSS

Do you need a quick and easy way to link to my articles? All the information you need is published with ASPRSS...