, ASP dynamically generated content in what way to output the highest efficiency?
Author: Cactus Studios This article hits: 123
Generating dynamic content on the server is one of the main reasons to use ASP, so the first test project we choose is to determine what method is best to send dynamic content to the response stream. There are two basic choices (and some of their changes): Using embedded ASP tags, using the Response.Write statement.
To test these different methods, we created a simple ASP page that first defines the variables and then inserts them into the table. Although this page is simple and has no practical purpose, it is enough to allow us to isolate and test each problem.
2.1 Using ASP Inline markup
The first test is to use the ASP's inline tag <%= x, where x is a variable. This is the easiest way to use it, and it makes the HTML part of the page easier to read and maintain.
<% OPTION EXPLICIT
Dim FirstName
Dim LastName
Dim middleinitial
Dim Address
Dim City
Dim State
Dim PhoneNumber
Dim Faxnumber
Dim EMail
Dim Birthdate
FirstName = "John"
MiddleInitial = "Q"
LastName = "Public"
Address = "Main Street"
City = "New York"
State = "NY"
PhoneNumber = "1-212-555-1234"
Faxnumber = "1-212-555-1234"
EMail = "John@public.com"
Birthdate = "1/1/1950"
% >
< HTML >
< head >
< title >response test</title >
< BODY >
< H1 >response test
< TABLE >
< TR >< TD >< B >first name:</></td >< TD ><%= FirstName% ></td >&L T /tr >
< TR >< TD >< B >middle initial:</></td >< TD ><%= middleinitial% ></t D ></tr >
< TR >< TD >< B >last name:</></td >< TD ><%= LastName% ></td >< /tr >