CPT 106
Franklin College
Fall 2003
<% =date %>
Brinkster server time: <% =time %>
Erich Prisner,

Active Server Pages

ASP

Hello <% =Request.Form("name") %>, welcome. This whole page is an ASP-page. It has the extension "asp". ASP-pages contain mixture of HTML tags and ASP tags. ASP Tags are enclosed in <% and %>. When you look above in the source code, you won't see any ASP tags, it's just a plain HTML page. The reason is that the server processes the ASP page, computes a plain HTML page, which is send to your server. As somebody bright said recently:

"<% =Request.Form("motto") %>"

The following command produces date:
<% =time %>
and this one the time
<% =date %>
The year is <% =year(now) %>, today is <% =weekdayname(weekday(now)) %>, the <% =day(now) %>th day of <% if month(now) = 1 then %> January. Welcome to the new semester. <% end if if month(now) = 2 then %> February. <% end if if month(now) = 3 then %> March. <% end if if month(now) = 4 then %> April. Semester is almost over, isn't it? <% end if if month(now) = 5 then %> May. <% end if if month(now) = 6 then %> June. <% end if if month(now) = 7 then %> July. <% end if if month(now) = 8 then %> August. <% end if if month(now) = 9 then %> lovely September. <% end if if month(now) = 10 then %> October. Have a good travel. <% end if if month(now) = 11 then %> November. <% end if if month(now) = 12 then %> December. <% end if %> On the Brinkster server, it is <% =minute(now) %> minutes past <% =hour(now) %> o'clock.

Variables

You assign variables by in the following way: <& varname = ... &>

Conditional statements

Conditional statments have the following form: < % if condition then % > Text < % end if % >. "Condition" is any logical condition, like "month(now)=9". "Text" is the text you want to see displayed if the condition is true. There is also the version
< % if condition then % > Text1 < % else % > Text2 < % end if % >
if you want to write also something ("Text2") in case the condition is false.

ASP tutorial


Erich Prisner, September 2003