A Brief Intro to ASP and VBScript
 | Although there are a number of ways to run "programs" on a web
server (specifically CGI-based programs written in Java, C, and VB),
scripting has become a popular technique. |
 | Scripting is easy to use for developing relatively complex applications. |
 | Key elements of scripting:
 | Web pages that contain script code |
 | A scripting engine (running on the server) that "interprets"
the script |
 | Output from the scripting engine is in HTML format (and sent to the
browser via HTTP) |
|
 | The scripting engine must be able to...
 | Access input from the browser (forms and URL) |
 | Output to the browser (HTML) |
 | Access the server (HTTP) |
 | Access the operating system (files, databases) |
|
 | Scripting languages come in a variety of syntax...VBScript, JavaScript,
Cold Fusion (primarily for database interaction) |
Following provides an overview of server-based scripting...


CGI (Common Gateway Interface)
 |
The protocol standard that describes/defines how web browsers, web servers,
and programs on a server can communicate. |
 |
When a web page is requested (i.e., a URL is submitted)
information is sent to the browser including:
 |
Querystring information (GET) |
 |
Data information (POST) |
 |
Browser information |
|
 |
The web server can pass this information to programs running
on the server (e.g., "CGI programs"). |
 |
The programs forward HTML to the web server which is sent
back to the browser. |
Things to note about CGI...
 |
It is NOT a programming language. |
 |
It IS a standard for how things happen between web
servers and applications. |
 |
Historically, Perl was the first language to popularly
implement CGI capabilities in commercial applications. |
 |
CGI can be implemented with C, Java, Perl, PHP, and other
executable and interpreted scripting languages. |

Active Server Pages (ASP)
A Microsoft technology for building CGI-based web server applications,
briefly...
 | Originally intended for IIS (Internet Information Server) and PWS (Personal Web Server)
environments (there is a product for UNIX called ChiliSoft that supports
ASP). |
 | Built on the Microsoft COM/DCOM technology, ASP is an object technology. |
 | Integrates easily with other COM/DCOM technologies such as ADO for
databases. |
 | Is implemented with VBScript and/or JavaScript (JScript). |

ASP Objects...
 | Request - get data from the web browser (form, URL) |
 | Response - output data to the browser (via HTTP) |
 | Server - manage aspects of the server |
 | Session - keep information for transactional processing |
 | Application - tracks information about an application (i.e., set of
pages on a server) |
All objects take advantage of object-based programming to...
 | Manage data "Collections" - input from browsers |
 | Properties - states and attributes of the server, application , etc. |
 | Methods - to get things done |
The Request object
The Request object is used to get information from the browser via the HTTP
request. Collection includes...
 | QueryString - get data from a URL request |
 | Form - to get data from an HTML form |
 | Cookies - get cookie data |
 | ServerVariables - set and get HTTP information such as the server
name |
The Response object
The Response object is used to send information to the user. Properties
for the response object include:
 | Buffer - stores data for sending until all processing is complete. |
 | ContentType - to set the type of content (i.e: text/HTML, Excel,
etc.) |
 | Expires - sets the expiration of a web pages (in minutes). |
The following methods are supported by the Response object:
 | AddHeader - adds HTML header with a specified value |
 | AppendToLog - Appends a string to the end of the Web server log
file |
 | BinaryWrite - sends binary data (i.e, graphics, spreadsheet
data) |
 | Clear - clears buffered HTML output. |
 | End - stops processing of the script. |
 | Flush - sends all of the information in the buffer. |
 | Redirect - redirect the user to a different URL |
 | Write - to write into the HTML stream. This can be done by using
the construct |
The Server object
The Server object supports one property, ScriptTimeout, which allows you to
set the value for when the script processing will time out, and the following
methods:
 | CreateObject - create an instance of a server-based component. This
component can be any component that you have installed on your server (such
as an ActiveX ). |
 | HTMLEncode - encode the specified string in HTML. |
 | MapPath - map the current virtual path to a physical directory
structure. |
 | URLEncode - applies URL encoding to a specified string. |
The Session object
The Session object is used to store information about the current user's
Web-server session. Variables stored with this object exist as long as the
user's session is active, even if more than one application (script pages) is
used. This object supports one method, Abandon, which abandons the
current Web-server session and destroys all objects
Two properties:
 | SessionID - the identifier for the current session |
 | Timeout - specifies time-out value for the session. |
The Application object
The Application object can store information that persists for the entire
lifetime of an application, that is, a group of pages with a common root.

Server Scripting - VBScript
 | VBScript is a derivative of Visual Basic (same syntax, a subset of total
VB environment) |
 | Origins, uses, background, versions - review text |
 | Data types, operators, evaluations, statements, structure - review text
and examples |
 | Creating and testing server scripts |

Environment for Running ASP...
 | Personal Web Server (Win 95/98/NT WS) or IIS (Win NT/2000) |
 | ASP is installed with the server |
 | ASP scripts must be run in a virtual directory or location with scripting
privileges turned on |
 | There are tools for UNIX platforms to run ASP (ChiliSoft) |

Web Sites
|