CoverYourASP --> ASP Render blocks

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
97 active users
8 visitors today
13 pages today
how is this done?
Tools I use

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

ASP.NET Blog
RSS submissions
E-commerce

Now open source with SourceForge!

A simple, normal, ASP page.

Consider this simple ASP file below:

<%@ 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>

Most of this file is plain HTML. It is simply streamed out to the browser as-is. The section of JavaScript wrapped in a <% %> is called a render block.

Render blocks aren't a terribly good idea. Many ASP examples out there use them, but I'm going to try and persuade you never to use them again. This may be an uphill struggle!

System Inefficiency

Let's bring out the big guns first. Microsoft doesn't think you should use them. They are inefficient because they force the system to constantly switch back and forth between "HTML mode" and "ASP mode". You know how hard it is to work when your kids are playing in the same room? That's what it's like having to stop and output some HTML when you're busy interpreting script.

Since we're not likely to be writing the next eBay any time soon, that might not be the most relevant argument, so let's try another.

Part 2: Wasting Bandwidth...

Featured sponsor
My favorite resources

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...