ASP Tutorials - Herong's Tutorial Notes
Dr. Herong Yang, Version 4.11

Active Server Pages (ASP)

ASP Tutorials - Herong's Tutorial Notes © Dr. Herong Yang

hyBook - Guestbook Application

Using MS Access Databases

ActiveX Data Object (ADO)

Controlling Response Header Lines

Microsoft Scripting Runtime DLL

Using Cookies

ASP Sessions

ASP Objects

Microsoft Script Debugger

Internet Information Services (IIS)

... Table of Contents

What is ASP?

ASP: Web pages that contains scripting statements executed by the Web server. The output of the scripting statements will be merged with the static parts of the page, and delivered to the browser as the response to the HTTP request initiated by the Web browser.

ASP is a technology, not a language. You can write the scripting statements in any language as long as the Web server can recognize them and execute them. The Microsoft Internet Information Server (IIS) 4.0 supports two scripting languages: Visual Basic Script (VBScript) and Java Script (JScript).

Non-ASP pages can also include scripting statements to be executed by the Web client, browser, not by the server.

An ASP enabled Web server can not only execute the embedded scripting statements, but it can also provides additional build-in objects and ability to access external objects. So there are 4 major areas the ASP technology can bring to your Web pages. We will discuss each of them in details in the following notes:

  • Expressions of the scripting language.
  • Build-in functions of the scripting language.
  • Web server build-in objects.
  • Web server provided build-in objects.
  • External DLL and DOM objects.

Static, Client Scripting and Server Scripting Pages

Here, I have 3 Web pages to display times from 3 different sources:

time_static.html: A static page displaying static time.

<html><body>The current static time is: 
11/26/1999 10:19:46 PM 
</body></html>

If you open this page with any Web browser, you should see the static time, which will not change when you open the page again some time later.

The current static time is: 11/26/1999 10:19:46 PM 

time_client.html: A client scripting page displaying the time dynamically out of the client system.

<html><body>The current client time is: 
<script language="vbscript">
document.write(Date & " " & Time)
</script>
</body></html>

If you open this page with any Web browser that can execute VBScript statements, like MS Internet Explorer (IE) 5, you will see the current time of the client system. The displayed time will change when you open the page again some time later.

The current client time is: 11/26/1999 10:26:08 PM 

time_server.asp: A server scripting (ASP) page displaying the time dynamically out of the server system. File name extension ".asp" is needed to inform Web server to be ready to execute the embedded script statements.

<%@ language="vbscript"%>
<html><body>The current server time is: 
<%
response.write(Date & " " & Time)
%>
</body></html>

Since an ASP page needs a Web server to execute the script statements, you need to copy this page to the document directory of the IIS server:

copy time_server.asp \inetpub\wwwroot

If you now open this page with IE 5 at http://localhost/time_server.asp, you will see the current of the server system. The displayed time will change when you open the page again some time later.

The current server time is: 11/26/1999 10:43:32 PM 

Notice that I am using the same scripting language, VBScript, for both time_clien.html and time_server.asp. But the syntaxes of defining the block of script statements are different.

Dr. Herong Yang, updated in 2002
ASP Tutorials - Herong's Tutorial Notes - Active Server Pages (ASP)