ThePlace

Home ] Search ] Resources ] Site Map ] Contact Me ]
Dave's Information Technology Resource

Up ]

[ ASP Background ] Creating ASP Pages ] ASP Objects ]

--- ASP Background ---

A Brief Intro to ASP and VBScript

bulletAlthough 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.
bulletScripting is easy to use for developing relatively complex applications.
bulletKey elements of scripting:
bulletWeb pages that contain script code
bulletA scripting engine (running on the server) that "interprets" the script
bulletOutput from the scripting engine is in HTML format (and sent to the browser via HTTP)
bulletThe scripting engine must be able to...
bulletAccess input from the browser (forms and URL)
bulletOutput to the browser (HTML)
bulletAccess the server (HTTP)
bulletAccess the operating system (files, databases)
bulletScripting 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)

bullet

The protocol standard that describes/defines how web browsers, web servers, and programs on a server can communicate.

bullet

When a web page is requested (i.e., a URL is submitted) information is sent to the browser including:
bullet

Querystring information (GET)

bullet

Data information (POST)

bullet

Browser information

bullet

The web server can pass this information to programs running on the server (e.g., "CGI programs").

bullet

The programs forward HTML to the web server which is sent back to the browser.

Things to note about CGI...

bullet

It is NOT a programming language.

bullet

It IS a standard for how things happen between web servers and applications.

bullet

Historically, Perl was the first language to popularly implement CGI capabilities in commercial applications.

bullet

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...

bulletOriginally intended for IIS (Internet Information Server) and PWS (Personal Web Server) environments (there is a product for UNIX called ChiliSoft that supports ASP).
bulletBuilt on the Microsoft COM/DCOM technology, ASP is an object technology.
bulletIntegrates easily with other COM/DCOM technologies such as ADO for databases.
bulletIs implemented with VBScript and/or JavaScript (JScript).

 

ASP Objects...

bulletRequest - get data from the web browser (form, URL)
bulletResponse - output data to the browser (via HTTP)
bulletServer - manage aspects of the server
bulletSession - keep information for transactional processing
bulletApplication - tracks information about an application (i.e., set of pages on a server)

All objects take advantage of object-based programming to...

bulletManage data "Collections" - input from browsers
bulletProperties - states and attributes of the server, application , etc.
bulletMethods - to get things done

The Request object

The Request object is used to get information from the browser via the HTTP request.   Collection includes...

bulletQueryString - get data from a URL request
bulletForm - to get data from an HTML form
bulletCookies - get cookie data
bulletServerVariables - 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:

bulletBuffer - stores data for sending until all processing is complete.
bulletContentType - to set the type of content (i.e: text/HTML, Excel, etc.)
bulletExpires - sets the expiration of a web pages (in minutes). 

The following methods are supported by the Response object:

bulletAddHeader - adds HTML header with a specified value
bulletAppendToLog - Appends a string to the end of the Web server log file
bulletBinaryWrite - sends binary data (i.e, graphics,  spreadsheet data)
bulletClear - clears buffered HTML output.
bulletEnd - stops processing of the script.
bulletFlush - sends all of the information in the buffer.
bulletRedirect -  redirect the user to a different URL
bulletWrite - 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:

bulletCreateObject - 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 ).
bulletHTMLEncode - encode the specified string in HTML.
bulletMapPath - map the current virtual path to a physical directory structure.
bulletURLEncode - 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:

bulletSessionID -  the identifier for the current session
bulletTimeout - 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

bulletVBScript is a derivative of Visual Basic (same syntax, a subset of total VB environment)
bulletOrigins, uses, background, versions - review text
bulletData types, operators, evaluations, statements, structure - review text and examples
bulletCreating and testing server scripts

 

Environment for Running ASP...

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

 

Web Sites

bulletMicrosoft ASP Site: http://msdn.microsoft.com/workshop/server/asp/ASPover.asp - tutorials, technology details
bulletCharles Caroll's Site - http://activeserverpages.com/ - local developer/expert, site has many examples
bulletEric Smith's site - http://asptechniques.com 
bullethttp://aspfree.com

 

 

Home ] Up ] Computer Architecture ] Programming Bootcamp ] Database Bootcamp ] Visual BasicS ] Web Basics ] Web Multimedia ] Web Programming ] Advanced Web Topics ] Developing Web Sites ] XML Technology ] Web Glossary ]

Copyright © 1999 - 2005 
ThePlace - Written and Sponsored by Dave Hillman