What is Active Server Pages?
Microsoft® Active Server Pages (ASP) is a server-side scripting
environment that can be used to create and run dynamic, interactive, high-performance
Web server applications. When the scripts run on the server rather than on the client,
Web server does all the work involved in generating the Hypertext Markup Language
(HTML) pages that are sent to browsers. There is no need to worry whether a browser
can process your pages, as the Web server does all the processing for it.
Active Server Pages (ASP) is a feature of and can be used with the following Web servers:
- Microsoft Internet Information Server version 3.0/4.0 on Windows NT Server
- Microsoft Peer Web Services Version 3.0 on Windows NT Workstation
- Microsoft Personal Web Server on Windows 95
Active Server Pages (ASP) represents a significant advance in Web technology. Web
technology has come a long way from linked static content to the dynamic,
interactive environment of ASP.
The Webs origins lie in linked static content, and many sites today remain
static: that is, one must manually edit HTML pages in order to change what the Web
server sends to a browser. In the static model, a browser uses the Hypertext
Transport Protocol (HTTP) to request an HTML file from a Web server. The server
receives the request and sends an HTML page to the browser, which formats and
displays the page. Although this model provides ready access to nicely formatted
pages of information for your employees or potential customers, it provides only
limited interaction between the user and the Web serverand the static pages
must be manually edited to update their content.
Gateway Interfaces such as Common Gateway Interface (CGI), Internet Server Application
Programming Interface (ISAPI), and others can be used to add dynamic content to the
Web. With these interfaces, a browser can send an HTTP request for an executable
application rather than for a static HTML file. The server runs the specified
application. The application can read information associated with the request to
determine what values were passed with the request, such as those values that a
user submits by filling out an HTML form. The application then parses the values
for meaningful information and generates output in HTML to send to the browser. The
disadvantage of gateway programs is that they are difficult to create and change.
Gateway programs are not integrated into HTML files; in fact, they require an entirely
different design process than do HTML files.
Active Server Pages (ASP) can include executable scripts directly in a HTML file.
HTML development and scripting development become the same process, enabling
focus directly on the look and feel of the Web site, weaving dynamic elements into
the pages as appropriate. An ASP file (.asp) is a text file and can contain any
combination of the following:
- HTML tags
- Script commands
Active Server Pages (ASP) applications are:
- Completely integrated with the HTML files.
- Easy to create, with no manual compiling or linking of programs required.
- Object-oriented and extensible with ActiveX server components.
This translates into tangible benefits, enabling Web providers to provide
interactive business applications rather than merely publishing content. For
example, a travel agency can go beyond just publishing flight schedules; it can
use ASP scripting to enable customers to check available flights, compare fares,
and reserve a seat on a flight.
The Active Server is implemented as an ISAPI filter running under IIS. Whenever
a Web client makes an HTTP request of a Web server, the Active Server ISAPI filter
gets a chance to intercept the request. If the request is for an .asp file, the
Active Server takes over from IIS and parses the entire file from top to bottom.
The scripts may access external ActiveX server components, the called ActiveX
server components may access external resources, for e.g. user property databases,
other servers like SMTP (e-mail), or external databases like SQL server. The results
of calls to ActiveX servers are sent back to the script interpreter (asp.dll),
which returns an HTML output file to IIS. IIS then returns this data stream to
the requesting Web client.
Active Server Pages (ASP) applications are easy to develop because one can use ASP
scripting to develop them. With ASP scripting, any scripting language can be used
for which the appropriate scripting engine is provided. ASP supports the use of
ActiveX components and scripting languages such as Visual Basic Script (VBScript),
JScript, and Perl. ASP supplies scripting engines for VBScript and JScript. The
primary scripting language that ASP assumes is VBScript by default. VBScript
is based on the Visual Basic programming language, but is much simpler. In many ways,
such as buttons and scrollbars, on their Web pages. To incorporate sophisticated
functionality in an ASP page, ActiveX server components can be used to process data
and generate useful information.
A web application built with Active Server Pages (ASP) uses a component model, so
pieces can be reused in other Web and client-server applications. ASP-generated
content is compatible with standard Web browsers.
Script writers often find that they need to accomplish certain tasks in their
scripts on a regular basis. For example, one might have a number of scripts, all
of which ultimately perform different tasks, but all of which need to get
information from a user. ASP Built-In Objects save the labor of
reinventing the wheel whenever there is a need to perform such a
common task. An object is a combination of programming and data that can be
treated as a unit.
To use most objects, one must first create an instance of that object.
However, Active Server Pages (ASP) includes five objects that do not require
instantiation. The following table summarizes these built-in objects and
||Get information from a user.
||Send information to a user.
||Control the ASP execution environment.
||Store information about a users session.
||Share information among users of an application.
ActiveX server components are designed to run on the Web server as part of a
Web-based application. Components package common dynamic features, such as database
access, so that one does not have to create and recreate these features.
Components are typically invoked from .asp files. However, one can invoke components
from other sources as well, such as an ISAPI application, another server component,
and other OLE-compatible languages.
Active Server Pages (ASP) includes five ActiveX server components:
|Database Access component
||Provides access to a database from within the Web application. One can then display the entire contents of a table, allow users to construct queries, and perform other database operations from Web pages.
|Ad Rotator component
||Displays and alternate a series of images, as well as it provides a link from the displayed image to another URL.
|Browser Capabilities component
||Because of the variety of browsers and browser capabilities on the Web, one may want to tailor the content sent to a browser based on the browser's capabilities. Browser Capability component can do this job.
|File Access component
||Retrieves and modifies information stored in files.
|Content Linking component
||Makes it easy to provide logical navigation through the .asp files
in an application. Rather than maintaining URL references in a number of .asp files.
Objects are the first internals available to the ASP developer. The functions
exposed by objects are the most common functions required by Active Server Pages.
Examples include creating instances of server components, manipulating text strings
with URL and HTML encoding.
Components have a similar function; viz., to extend the functionality
of the Active Server, but they have one fundamental difference:
they are .dll files that run separately from the Active Server,
but in the same address space as the server. Microsoft wrote these
.dll files, but one can create his own components in any language
that produces code compliant with the Component Object Model (COM)
specification. By creating .dll files (and not .exe files that
execute in their own address space), components can be given
maximum speed. Active Server components do not have a user interface,
server components need to support only three interfaces (IUnknown, IDispatch,