ASP Basics

Active Server Pages imply what is actually occurring. Normally, when a browser requests a page, the server simply finds the page requested and sends it on it's merry way. However, by adding specific software, and by creating pages with special suffixes and scripting languages, a web browser's request for a page can "activate" the server to process the scripts prior to delivering the page.

In this tutorial, we will be looking at VBScript (Visual Basic Scripting Language) for Active Server Pages (ASP). In order to let the web server know it must process the VBScript prior to returning the browser's request, the pages with the script must be named with the ".asp" suffix.

Normally when you view a webpage, it is followed by either the ".htm" or ".html" suffices. The server does nothing but find the file and send it to the requesting browser. However, if you name a file: somefile.asp, and place it in your web server's directory, this page will prompt the server to process the included VBScript code, if there is any, prior to "spitting out" the HTML which the browser reads.

Below, you can see a simple example of a VBScript page:


<%
Dim strFirstName, strLastName

strFirstName = "Joe"
strLastName = "User"
%>
<html>
<head>
	<title>Untitled</title>
</head>

<body>
Hello <% response.write strFirstName & " " & strLastName %>

</body>
</html>

The above code simply declares two variables, strFirstName and strLastName, and assigns values to them, Joe and User, respectively. By using the brackets <%    %> this tells the server that the content between them should be handled prior to any HTML code. Also note that the use of the single quote "'" denotes comments that help describe the purpose of the nearby code or function.

Next