Active Server Pages Overview

Some of the Panagon Web WorkFlo and most of the Panagon Web Services components rely on the ASP object model and server-side scripting to function. This topic provides a high-level overview of ASP, as it is used in eProcess Services.

Server-side scripts run when a browser requests an .asp file from the web server. The server processes the ASP file from top to bottom and executes the script commands in the sequence they appear in the page. Because the scripts run on the server, the web server performs all of the necessary processing and returns the requested data back to the client browser in a HTML page – without the server-side scripting code.

You can include client-side script in the same ASP page. The server-side script executes before the server returns a response, but the client-side script is sent as part of the response. Additionally, you can include other pages in your ASP. The included files are treated as part of the ASP file during execution. The included files are executed from beginning to end before returning to the page that called the file.

There are two benefits to using server-side scripting:

Any statements placed between the <%. . .%> delimiters are treated as script statements. While you can use any script language supported by the Microsoft Script Host, the Panagon Web Services and Web WorkFlo components use VBScript for all server-side scripting and Javascript for all client-side scripting.

ASP Objects

You can use the following objects in the Active Server Page Object Model: Server, Application, Session, Request, and Response. The Server object is actually the operating environment for the Active Server Pages. (Since the WorkFlo architecture does not rely on MTS transactions, you should not attempt to use the ObjectContext object.)

For more information on the Active Server Page Object Model objects, their methods and properties, and how to use them, refer to the Microsoft MSDN documentation.

ASP Example

This example illustrates the structure of a simple ASP file, what the client's browser might display, and shows the source received by the client for the request.

Assume that an ASP file contains the following content:

<%@ Language=VBScript %>
<HTML>
<HEAD>
<TITLE>Sample ASP Page showing a loop</TITLE>
</HEAD>
<BODY>
<H1>Looping a variable</H1>

<%
' Before sending the response back to the client, loop
' through a count 5 times and use a Response.Write
' statement to print the current loop count in the HTML document.

Dim loopNum, loopString

' Dimension two variables; one for holding an integer and one
' for holding the dynamically updated, HTML formatted string.

For loopNum = 1 to 5
  loopString = "<font color='#0000FF'>The current loopNum count equals: " & loopNum & "</font><BR>"
Response.Write(loopString)
Next
%>

<P>This paragraph is static HTML content.</P>

<SCRIPT Language="Javascript">
/* This is an example of client-side code executed on the client. */
document.write("Today's date is " + Date());
</SCRIPT>
</BODY>
</HTML>

When a client requests the ASP file containing the source shown above, the user sees content similar (the formatting might be different) to the following in the client browser:

Looping a variable

The current loopNum count equals: 1
The current loopNum count equals: 2
The current loopNum count equals: 3
The current loopNum count equals: 4
The current loopNum count equals: 5

This paragraph is static HTML content.

Today's date is Fri Sep 12 06:00:00 2036

If the user views the source, delivered as a response the initial ASP request, he or she would see the following HTML formatted code:

<HTML>
<HEAD>
<TITLE>Sample ASP Page showing a loop</TITLE>
</HEAD>
<BODY>
<H1>Looping a variable</H1>
<font color='#0000FF'>The current loopNum count equals: 1</font><BR>
<font color='#0000FF'>The current loopNum count equals: 2</font><BR>
<font color='#0000FF'>The current loopNum count equals: 3</font><BR>
<font color='#0000FF'>The current loopNum count equals: 4</font><BR>
<font color='#0000FF'>The current loopNum count equals: 5</font><BR>
<P>This paragraph is static HTML content.</P>
SCRIPT Language="Javascript">
/* This is an example of client-side code executed on the client. */
document.write("Today's date is " + Date());
</SCRIPT>
</BODY>
</HTML>

Note While the Javascript source included in the original ASP file was included in the response sent to the client browse, none of the server-side VBScript statements were included.