You are viewing a plain-jane printable version of http://CoverYourASP.com/DontRender.asp.
See how this was done

 

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