Getting Started With Active Server Pages

This brief look at Active Server Pages (ASP) is intended to jump start developers new to this Microsoft technology. It is arranged as question/answer, but is not truly a FAQ.

What is an Active Server Page?

An active server page is a file on a Web server with the extension .asp. It may contain HTML, scripting language code or both. The script is typically bounded by the <% and %> symbols. It can also reside within a <SCRIPT> </SCRIPT> pair with RUNAT=SERVER specified.

What is an Active Server Page application?

An ASP application is a set of related ASP pages that share an execution context. The pages typically exist in a single virtual directory and its subdirectories. (This was a requirement with IIS 3 that has been relaxed in IIS 4.) There is usually a file named global.asa in the virtual root of the application that is used during application and session initialization. A later section explains more fully the "execution context" and the concepts of "application" and "session".

How is the scripting language processed for an Active Server Page?

The Web server must be either implicitly or explicitly configured to recognize the .asp extension as an Active Server Page, and files of this type must be associated with the ASP engine for processing. Microsoft Web servers load asp.dll as the ASP engine. The engine parses the page first, then "executes" it by passing any HTML directly to the Web client and interpretting the script. The next section goes into more detail about the interpretting phase.

What is the Active Server Page scripting environment?

ASP supports the Microsoft supplied VBScript and JScript languages. I believe it supports additional languages that can operate in an Active Scripting host.

Several objects are automatically created an available for access by the script. These are Application, Session, Request, Response and Server.

Can non-scripted content be used in Active Server Pages?

Any COM object supporting Automation can be created with the Server.CreateObject method or the <OBJECT> tag. This is quite commonly done with the Active Data Objects (ADO). Most COM objects operate unaware that they are being used within the context of an ASP page. However, it is also possible to write COM objects, sometimes known as ActiveX Servers, that are aware of the ASP environment. These objects can define methods named OnPageStart and OnPageEnd that will be called at the start and finish of processing of an ASP page. (Note that in IIS 4, it is less common to use these because of the integration with MTS.) Further, they can access the "built-in" ASP objects Application, Session, Request, Response and Server. Since Visual Basic can create COM objects, it is not uncommon to move VBScript code out of the interpretted ASP page and into a native-code DLL.
Copyright © 1998 Scott Nichol.
07-Mar-98