0% found this document useful (0 votes)
286 views

E-Commerce: Internet Technology and Programming

The document provides an overview of Active Server Pages (ASP) and its evolution. It discusses how ASP built upon earlier technologies like Common Gateway Interface (CGI) and Internet Server Application Programming Interface (ISAPI) to enable server-side scripting and dynamic web page generation. It also describes how ASP is based on the Common Object Model (COM) which provides a standard for communication between software components. The document is divided into multiple parts that cover topics like ASP objects, databases, and electronic commerce.

Uploaded by

Abdulraheman
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
286 views

E-Commerce: Internet Technology and Programming

The document provides an overview of Active Server Pages (ASP) and its evolution. It discusses how ASP built upon earlier technologies like Common Gateway Interface (CGI) and Internet Server Application Programming Interface (ISAPI) to enable server-side scripting and dynamic web page generation. It also describes how ASP is based on the Common Object Model (COM) which provides a standard for communication between software components. The document is divided into multiple parts that cover topics like ASP objects, databases, and electronic commerce.

Uploaded by

Abdulraheman
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 34

Jatin Soni : 9904181899 : Hi Friends.

PAPER – 303

Internet Technology and


Programming

A Concise Reading Material on

ASP
and
E-COMMERCE
Prepared By :–

Jatin Soni : 9904181899 : Hi Friends.


Jatin Soni : 9904181899 : Hi Friends.

Bholabhai Patel
College of Computer Studies,
Gandhinagar

Preface
ASP and E-Commerce Syllabus
 Introduction to ASP
 ASP Objects
 ActiveX Data Objects

The Details of Concise Reading Material


The concise reading material is prepared keeping in mind
the percentage of the topic – ASP and E-Commerce in
the Paper–303, Internet Technology and Programming of
TY BCA. The coverage of this topic is only 10% of the
entire syllabus hence the reading material is prepared
such that it covers all the topics mentioned in the
syllabus briefly. Each topic is explaining the introduction
of that topic, the overall concept and the procedure
require to implement the concept covered in the topic
with necessary coverage. The readers who wish to
explore the topics covered in the material thoroughly can

Jatin Soni : 9904181899 : Hi Friends.


Jatin Soni : 9904181899 : Hi Friends.

refer the reference books


mentioned in the syllabus. The elaborated discussion is
available in the reference books.

The reading material is divided into following Four Parts


:-
Part – I :- Introduction to ASP
Part – II :- Working with Objects
Part – III :- Databases and ASP
Part – IV :- Electronic Commerce

Jatin Soni : 9904181899 : Hi Friends.


Jatin Soni : 9904181899 : Hi Friends.

Contents
Part – I :- Introduction to ASP

 The Evolution of Active Server Pages


 Common Gateway Interface (CGI)
 Internet Server Application Programming Interface
(ISAPI)
 Active Server Pages and the Active Server Model :- A
COM - Based Evolution
 The Composition of Active Server Pages
 ASP Delimiters
 Setting the ASP Scripting Language
 Variables, Operations, and Statements
 Active Server Components and Objects
 Server Side Includes
 Static versus Dynamic Content
 An Example of ASP Page
 How ASP Differ from Client-Side Scripting Technologies
 Understanding the Client - Server Model of Internet
 An overview of the elements of the technology
o Hypertext Transfer Protocol (HTTP)
o Web Server
o Browser
o Server Methods
 Active Server Pages
 The Active Server Pages Model
 The .asp File
 The Script
 The Process of Serving An Active Sever Page

Jatin Soni : 9904181899 : Hi Friends.


Jatin Soni : 9904181899 : Hi Friends.

 The Components of an Active


Server Pages Application
 Text Files
 Physical, Root and Virtual Directories
 ASP Scripting Languages and HTML
 Creating, Developing and Running an ASP Page
 Running ASP Pages
o Setting Up Personal Web Server
o Setting Up Internet Information Server
o Using ASP Without IIS or PWS
 Creating ASP Pages
 Tools For Developing/Writing ASP Code
 Notepad
 Using Visual InterDev
 Using FrontPage
 The ASP Project File : GLOBAL.ASA

Part – II :- Working with Objects


 The Building Block of Objects
 Properties
 Methods
 Collections
 Instances of Objects
 The Fundamental Built-in ASP Objects
 An ActiveX Object
 Active Server Pages Objects – At a Glance
 Application Object
 Server Object
 ObjectContext Object
 Session Object

Jatin Soni : 9904181899 : Hi Friends.


Jatin Soni : 9904181899 : Hi Friends.

 Request Object
 Response Object
 Error (Err) Object
 Active Server Pages Objects – In Detail
 Application Object
 Server Object
 Session Object
 Request Object
 Response Object

Part – III :- Databases and ASP


 Introduction
 Working with Connections and Data Sources
 ADO
 OLEDB
 ODBC
 Communicating with a Database Using ActiveX Data
Objects (ADO)
 Brief Description of Six ADO Objects (Connection
Object, Recordset Object, Error Object, Field
Object, Command Object, Parameter Object).
 Connecting to a Database
o The Connection Object
o Using a System DSN
o Using a DSN-less Connection
o Opening the Connection
o Closing the Connection
 Reading Data from the Database
o The Recordset Object
Jatin Soni : 9904181899 : Hi Friends.
Jatin Soni : 9904181899 : Hi Friends.

o The Open Method


o Reading and Displaying the Contents of a
Database Table

Part – IV :- Electronic Commerce

 Introduction
 What is Electronic Commerce?
 Business-to-Business e-Commerce
 Business-to-Customer e-Commerce
 Customer-to-Customer (C2C) e-Commerce
 Hardware and Software Requirement for Electronic
Commerce
 Advantages and Disadvantages of Electronic
Commerce
 Benefits of Electronics Commerce
 Issues in Electronic Commerce
 Privacy and Security
 Electronic Payment Systems
 Implementation Issues

Jatin Soni : 9904181899 : Hi Friends.


Jatin Soni : 9904181899 : Hi Friends.

Part – I
Introduction to ASP

With the explosive growth of the Internet in our everyday lives,


there is high demand today for developers who can create data-
driven web sites. With the Internet becoming a central part of
both business and pleasure, Web site creation is quickly becoming
one of the fastest growing sectors. In the early days of the World
Wide Web, Web site design consisted primarily of creating fancy
graphics and nice looking, easy-to-read Web pages. As today’s
Web sites have become user interactive, the steps in Web site
design have changed. The primary focus has shifted from
graphical design to programmatic design. For example, imagine
that you wanted to create Web site from which you can sell
widgets. The programmatic design, creating the Web pages that
will collect and store user billing information, for example, is more
effective. Active Server Pages, commonly abbreviated as ASP,
are Microsoft’s solution to creating dynamic Web pages – one that
can interact with users. ASP allows powerful Web site creation by
combining programmatic code with standard HTML.

The Evolution of Active Server Pages


The concept of processing application logic on the Web server and
connecting to external servers from the Web server is not a new
idea specific to ASP. The capability to create dynamic HTML by
sending information to an executable file existed before the

Jatin Soni : 9904181899 : Hi Friends.


Jatin Soni : 9904181899 : Hi Friends.

emergence of ASP through the


Common Gateway Interface (CGI). CGI enables direct
communication and processing mechanism between the
requesting client browser, the gateway program, and the HTTP
server. The CGI program help create a standard interface with the
HTTP server to eliminate having to learn the specifics of Hyper
Text Transfer Protocol. CGI program are usually written in a
scripting language such as Practical Extraction and Report
Language (PERL). When a PERL script is called on the Web
server, the Web server treats the PERL script as a separate
executable. Because the hosting server treats CGI applications as
separate executables, a new process is created for each instance
in which the CGI applications is called. Creating a new process on
the server is a very expensive resource task and can cause
significant resource drain and performance issues. Furthermore,
CGI applications suffer from the inability to share information
across applications.
The Internet Server Application Programming Interface
(ISAPI) builds on the lesson learned from the shortcomings found
in CGI applications. ISAPI shares the same functional aspects of
CGI programming but differs from traditional CGI Programming in
the way the scripts is executed. ISAPI relies on loading scripts into
the HTTP server’s memory space to reduce the resource drain
required to create a new process.
Active Server Pages and the Active Server Model :-
A COM – Based Evolution

Jatin Soni : 9904181899 : Hi Friends.


Jatin Soni : 9904181899 : Hi Friends.

With the development of the


Common Object Model (COM) – a standard developed by the
Microsoft to create a standard communication mechanism
between components. This binary standard would enable non-
vendor specific components to interface with each other. When
components had a communication standard, cross-vendor
components should share their property, methods, and events
with other components. This process of activating another
component’s properties, methods and events is known as OLE
automation.
An example of OLE automation is the capability to embed an
Excel spreadsheet in a Word document. However, the OLE
automation offers great flexibility in application development.
Distributed COM (DCOM) is a Microsoft standard that enables
COM objects to communicate across machine boundaries
regardless of network configurations. The distributed component
communication mechanism is the foundation that provides the
Internet Information Server (IIS) and ASP the flexibility to
communicate with other COM-based systems. For example, this
functionality enables you to expose database information from
any ODBC – compliant data source, access mainframe data via
the SNA server, and extract information from COM – based
servers, such as Lotus Notes, Exchange, or your own customize
server. ASP represents the capability to process application logic
on the Web server. The ASP scripting engine can process any
script-compliant language, such as VBScript and JScript. These

Jatin Soni : 9904181899 : Hi Friends.


Jatin Soni : 9904181899 : Hi Friends.

script-compliant languages are


referred to as ActiveX scripts because they can be processed on
the Web server. The ActiveX scripting engine is actually a COM
component itself.

The Composition of Active Server Pages


Most of the Internet Information Server’s expanded connectivity
features are a result of the processing of logic in Active Server
pages. Active Server Pages are text-based files comprised of a
combination of HTML tags and Active Server scripts. The Active
Server engine, whether written in VBScript, JScript, or your own
script-compliant language, are interpreted by the Active Server
engine. The Active Server scripts usually contain variables,
operators, and statements to control the application logic
processed by the server.
ASP Delimiters :- Active Server scripts are distinguished on
the page from HTML tags (> and < symbols) and normal content
by using the <% and %> delimiters. The delimiters can either be
grouped to contain multiple lines of script code or can be
embedded within HTML tags.
Setting the ASP Scripting Language :- Active Server
Pages contains two parts: programmatic code and embedded
HTML. The programmatic code can be written in a number of
scripting languages.
 Tip:- A Scripting language is a particular syntax used to

execute commands on a computer. A program composed

Jatin Soni : 9904181899 : Hi Friends.


Jatin Soni : 9904181899 : Hi Friends.

of commands from a
particular scripting language is referred as a script.

Some popular Web related scripting languages include VBScript


and Java Script. When creating an ASP page, you can use one of
the four script languages:
 VBScript – Similar to Visual Basic’s syntax, the most
commonly used scripting language for ASP.
 JScript – Microsoft’s version of Java Script which is similar to
Java Script.
 PerlScript – Similar to Perl.
 Python – A powerful scripting language commonly used for
Web development.
Most ASP pages are created using VBScript. It has the most
English like syntax of the four scripting languages and is similar to
Visual Basic’s syntax. ASP page can also contain HTML. This
allows for the existing static Web pages to be easily converted
into dynamic pages.There are two different ways to set the
scripting language that will process the ActiveX scripting logic.
The first method is to rely on the default scripting language of the
Internet Information Server, VBScript. To prevent errors because
of an incorrect scripting language trying to interpret your scripts,
use the LANGUAGE attribute to explicitly define the proper
scripting interpreter, as shown here:
<%@ LANGUAGE=”VBSCRIPT” %>
If JScript was the desire scripting language, use JScript with the
LANGUAGE tag, as shown here <%@ LANGUAGE=”JSCRIPT” %>.

Jatin Soni : 9904181899 : Hi Friends.


Jatin Soni : 9904181899 : Hi Friends.

Alternatively, server-side scripting


can be implemented outside the Active Server delimiters by using
the <SCRIPT> tag and RUNAT attribute.
Variables, Operations, and Statements :- In order to
process application logic and workflow, each scripting language
has its own specific syntax that is used to define and set
variables, use operators for comparing items, and use statements
to help define and organize the code.
Active Server Components and Objects :- The scripting
variables, operators, and statements can be used to tap into
special Active Server tools that add programming functionality to
the ActiveX Server. These tools consist of Active Server objects
and Active Server components. Active Server objects are built-in
objects that collectively represent the functionality of the ActiveX
Server. Six individual objects are used to dissect the different
roles and responsibilities of the server into manageable and
programmable aspects.
Active Server components run on the server to provide extra
functionality that extends the reach of the Active Server Page
beyond the Web server. For example, you can use Active Server
Components to create a database connection; create, send, and
manage e-mail; determine the requesting browser type; and
much more. Furthermore, you are not limited to only the
components that ship with the Internet Information Server; you
can build and distribute your own components.

Jatin Soni : 9904181899 : Hi Friends.


Jatin Soni : 9904181899 : Hi Friends.

Server Side Includes :- Your


Active Server Pages can also use Sever Side Includes (SSI). SSI
is enables you to insert information from a text file into your
Active server Pages before the page interpreted. Server Side
Includes are very useful for adding information that is common
across multiple pages, such as header, toolbar, or footer
information.
Static versus Dynamic Content
 Static Content :- When you visit a static Web page through a
Web browser, the following steps occur:
1. The client (the Web browser) locates the Web server
specified by the first part of the URL (i.e.
www.something.com).
2. The client then requests the static Web page specified by the
second part of the URL (i.e. index.html).
3. The Web server sends the contents of that particular file to
the client in the HTML format.
4. The client receives the HTML sent by the server and renders
it for you, the user.
In case of static Web page, the Web server sends that page to the
client and then returns to idly wait for next request. In case of
dynamic Web pages, the Web server must play a more active role.
 Dynamic Content :- Dynamic page generally contains a
combination of HTML and programmatic code. When a Web
browser requests an ASP (i.e. dynamic) page, the following
steps occur:

Jatin Soni : 9904181899 : Hi Friends.


Jatin Soni : 9904181899 : Hi Friends.

1. The client (the Web browser)

locates the Web server specified by the first part of the URL
(i.e. www.something.com).
2. The client then requests the ASP page specified by the
second part of the URL (i.e. /default.asp).
3. The Web server reads the ASP file and processes the code.

4. After the ASP page has been completely processed by the

Web server, the output is sent in the HTML format to the


client.
5. The client receives the HTML sent by the server and renders
it for you, the user.
The client cannot tell the difference between an ASP page and a
static Web page because, in both cases, it receives just HTML.
When the Web server processes an ASP page, all the
programmatic code is interpreted on the server – none of it is sent
to the client.
An Example ASP Page
Let’s briefly look at an example ASP page. Listing contains code
that displays the current date and time. To execute the code in
listing, you first need to install a Web server on your computer.

Code Listing :- An ASP page displaying the current Date and


Time.
1: <%@ Language=VBScript %>
2: <HTML><BODY>
3: The current time is <% Response.Write Time() %>
4: </BODY></HTML>
Jatin Soni : 9904181899 : Hi Friends.
Jatin Soni : 9904181899 : Hi Friends.

ASP code is surrounded by a <% and %>. When an ASP page is


requested from a Web server, the Web server fully processes all
the code between <% and %> before sending output to the
client. Here the Line-1 informs the Web server that it is using the
VBScript as a scripting language. The Time() function in Line-3 is
a VBScript function. The Response.Write outputs the results of
the Time() function to the client. To test this listing create a file
named CurrentTime.asp and place it in your Web site’s root
directory. Next, load your favorite browser and type the URL
http://machineName/CurrentTime.asp or
http://localhost/CurrentTime.asp. Here machineName is the name
of your computer.

Jatin Soni : 9904181899 : Hi Friends.


Jatin Soni : 9904181899 : Hi Friends.

How ASP Differ from


Client-Side Scripting Technologies
When using ASP, it is vitally important to understand that ASP
code exists on the server only. ASP code, which is code
surrounded by the <% and %> delimiters, is processed
completely on the server. The client cannot access this ASP code.
In contrast, the client-side scripting is programmatic code in
an HTML file that runs on the browser. Client-side scripting code is
simply HTML code and is denoted by the <SCRIPT> HTML tag.
When the Web page containing the client side scripting is
requested the entire contents would be sent to the browser when
the client requested the Web page. The browser, when rendering
the HTML, would display the contents as per the code written in
the client-side script. Client-side script is not processed at all by
the Web server, only by the client (i.e. browser). It is client’s
responsibility to execute any and all client-side scripts. Client-side
scripting and the ASP code are two different things and cannot
interact with one another. ASP scripts are Server-Side Scripts.
Server-Side Scripts are processed completely on the Web Server.
The client does not receive any code from server-side scripts;
rather, the client receives just the output of the server-side
scripts. Client-side scripts and server side scripts cannot interact
with one another because the client-side scripts are executed on
the client, after the server-side scripts have finished processing
completely.

Jatin Soni : 9904181899 : Hi Friends.


Jatin Soni : 9904181899 : Hi Friends.

Server-side scripts cannot be


readily copied because only the result of the script is returned to
the browser. Users cannot view the script commands that created
the page they are viewing. The <SCRIPT> element is used to
indicate the primary scripting language being employed. This can
be abbreviated as <%@ LANGUAGE = Scripting Language>
called Directive. The <% %> is used to delimit the script code
that is run called Scriplets.

Understanding the Client – Server Model of


Internet
The Internet operates on the client-server model. In a client-
server model, two computers work together to perform a task. A
client computer requests some needed information from a server
computer. A server returns this information, and the client acts on
it. A typical Web application involves two basic components: the
Client (i.e. browser) and the Server (i.e. Web server) and a
protocol by which two components can interact and exchange
data. Practically almost all references to the Web applications
refer to applications using the HTTP (Hyper Text Transfer Protocol).
The client part is known as the browser whereas server essentially
implies the web server process.

Jatin Soni : 9904181899 : Hi Friends.


Jatin Soni : 9904181899 : Hi Friends.

An overview of the
elements of the technology :-
 Hypertext Transfer Protocol (HTTP) is the protocol used for
communication between browsers and Web server. Http uses a
request/response model of communications – essentially the
client-server model. A browser establishes a connection with a
server and sends a response back to the browser.
 A Web Server is a computer that contains all the Web pages
for a particular Web site and has special software installed to
send these Web pages to Web browsers that request them.
 A Browser connects with a Web server by establishing a TCP
connection at port 80 of the server. This port is the address at
which Web servers "listens" for browser requests. Once a
connection has been established, a browser sends a request to
the server. This request specifies a request method, the URL of
the document, program, or other resources being requested,
the HTTP version being used by the application layer protocol
serving as an interface between the local TCP/IP port and
browser/server process.

Jatin Soni : 9904181899 : Hi Friends.


Jatin Soni : 9904181899 : Hi Friends.

BROWSER SERVER

HTTP TCP/IP HTTP

The above figure shows the working of client-server model in


which browser acts like a client and server is a particular Web
server. The browser requests a Web page from the Web server
and the Web server returns the Web page to the client.

Server request methods are available. GET, HEAD and POST are
the most commonly used ones.
 The GET method is used to retrieve the information contained
at the specified URL. This Method may also be used to submit
data collected in an HTML form or to invoke a Common
Gateway Interface (CGI) program. When the server processes
a GET request, it delivers the requested information an HTTP
header that provides data about the server, identifies any
errors that occurred in processing the request, and describes
the type of information being returned as result.
 The HEAD method is similar to the GET method except that
when a Web server processes a HEAD request it only returns
the HTTP header data and not the information that was the

Jatin Soni : 9904181899 : Hi Friends.


Jatin Soni : 9904181899 : Hi Friends.

object of the request. The HEAD


method is used to retrieve information addressed by the URL.
 The POST method is used to inform the server that the
information appended to the request is to be sent to the
specified URL. The POST method is typically used to send from
data and other information to Common Gateway Interface
Programs. The Web server responds to a POST request by
sending back header data followed by any information
generated by the CGI program as the result of processing the
request.

Active Server Pages


Microsoft’s 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. This
enables Web providers to provide interactive business
application rather than merely publishing content. Only working
knowledge of HTML is required to begin using ASP. ASP enables
the inclusion of executable scripts directly in HTML files. ASP
applications are:
 Completely integrated into HTML files.
 Easy to create, with no manual compiling or linking of
programs required.
 Object-Oriented and extensible with ActiveX server
components.

Jatin Soni : 9904181899 : Hi Friends.


Jatin Soni : 9904181899 : Hi Friends.

ASP is an open, compile-free


application environment in which you can combine HTML, scripts,
and reusable ActiveX server components to create dynamic and
powerful Web-based business solutions. Active Server Pages
enables server side scripting for IIS with native support for both
VBScript and JScript.
Microsoft's Active Server Pages (ASP) is a server-side scripting
environment primarily for the Microsoft Internet Information
server (IIS) Web server, although third party vendors have
recently ported ASP to other Web servers as well. The ability to
write scripts in standard scripting languages such as VBScript,
JavaScript, or other scripting languages such as PerlScript enables
developers to create applications with almost any type of
functionality. This makes the ASP approach to a server-side
Scripting very generalizing for a broad range of ActiveX controls
for a variety of functions, such as database access via ODBC, like
other parsed HTML that is sent to the Web browser parses an ASP-
enabled page. This means that ASP-enabled pages work equally
well on every browser.
ASP is a feature of and can be used with the following Web
Servers:
 Microsoft’s Internet Information Server version 4.0 on
Windows NT Server
 Microsoft’s Peer Web Services version 3.0 on Windows NT
Workstation.
 Microsoft’s Personal Web Server on Windows 95/98.

Jatin Soni : 9904181899 : Hi Friends.


Jatin Soni : 9904181899 : Hi Friends.

The Active Server Pages


Model
A server-side script begins to run when a browser requests an
.asp file from your Web server. Your Web server then invokes/calls
the .asp file, which processes the requested file from top to
bottom, executes any script commands, and sends an HTML page
to the browser. Because your ASP scripts run on the Web server
rather than on the client, your Web server does all the work
involved in generating the HTML pages sent to browsers.

BROWSER HTTP Request WEB SERVER


ACTIVE
SERVER
HTTP Response PAGES

The .asp File :- ASP is built around files with the filename
extension .asp. An .asp file is a text file and can contain any
combination of the following:
 Text
 HTML Tags
 Script commands – A script command instructs your
computer to do something, such as assign a value to a
variable.
A Web sever must process an .asp file. To make the .asp file
available to Web users, save the new file in a Web publishing
directory under a Web server.

Jatin Soni : 9904181899 : Hi Friends.


Jatin Soni : 9904181899 : Hi Friends.

The Script :- A script is a series of


sentences placed one below the other in the form of a paragraph.
Each sentence will be written in the syntax (grammar) of the
scripting language of choice. Thus the paragraph created will be
be the Script. A script can assign a value to a variable, it can
instructs the Web server to send something, such as the value of
a variable, to a browser, Combine commands into procedure is a
named sequence of commands and statements that act as a unit.
Executing a script sends the series of commands to a scripting
engine, which interprets and relays them to the computer’s CPU.
Scripts are written in a language that has specific grammar
(syntax) hence, to use a given scripting language, the Web server
must have a scripting engine that understands the language.
The Process of Serving An Active Sever Page :- A
user enters the internet address of an ASP file into the
address/location bar of a Web browser.
http://www.sctindia.com/hello.asp
 The browser sends a request to the Server for an ASP file.
 The Web server receives the request and recognizes that the
request is for an ASP file from the .asp extension of the file.
 The Web server retrieves the proper ASP file from the disk or
memory.
 The Web server sends the file to a special program named
the ASP.dll.
 The ASP.dll processes the ASP from top to bottom. Any
internal commands encountered are executed. The result

Jatin Soni : 9904181899 : Hi Friends.


Jatin Soni : 9904181899 : Hi Friends.

(output) of this process is a


standard HTML file.
 The (standard) HTML file is sent back to the browser.
The ASP scripting engine is a COM (Component Object Model)
object that process scripts. The COM object is a host environment
provided by ASP technology, which runs scripts placed in
filename.asp. An ASP enable browser passes scripts within the
.asp file to the ASP engine (i.e. the COM object) for processing.
For each scripting language that can be used with ASP scripting,
its related scripting engine (i.e. related COM object) must be
installed on the Web server.
Figure: The ASP Process.

The
Client’s
System

Jatin Soni : 9904181899 : Hi Friends.


Jatin Soni : 9904181899 : Hi Friends.

SERVER

Request ASP.dll
Pre-processing Scripting Engine
HTML for display
Translated to HTML Execution

The above figure provides a picture of the ASP goes through to


send a page to the user. There are five stages that we will concern
ourselves with at this point:
1. Request – The Web browser contacts the server and tells it
what page it wants to see.
2. Preprocessing – The ASP.dll file does some initial processing
on the requested script.
3. Execution – The scripting engine executes the instructions in

the script.
4. Translation – ASP translates the results of the execution into

HTML.
5. Display – The HTML is sent back to the Web browser, which

processes the tags and displays the page.


The ASP process ends when the page is sent back to the user.

Jatin Soni : 9904181899 : Hi Friends.


Jatin Soni : 9904181899 : Hi Friends.

The Components of an
Active Server Pages Application
An ASP application is comprised of various items that together
form the ASP Application. The collection consists of various text-
based files, Server objects and components, and Active server
scripting, as shown in the Figure below.
Figure: The diverse collection that forms ASP applications.
Server-Side Scripting Client-side
Scripting

 VBScript, JavaScript – VBScript,


Java Script
 Perl, CGI, REXX – ActiveX
Controls
 Java, ISAPI – Java

Server Side Objects


Active Server Text
 Built-in object that controls the – ASCII
text Pages engine
Active Server scripting (ASP)
represents content
And forms
HTML tags

File System Server-side


Components

 Virtual physical, and Root directories – COM based


objects
 Controls permissions – Scalable,
manageable, and

Jatin Soni : 9904181899 : Hi Friends.


Jatin Soni : 9904181899 : Hi Friends.

 Defines application
distributed via MTS

Text Files :- ASP applications are really a collection of text files

that are interpreted by the Internet Information Server. These ASP


scripts are composed of HTML tags, Active Scripting Code (using
languages such as Jscript and VBScript), and standard text, as
shown in the Listing.

Listing: An Asp file uses HTML tags, ASP scripts, and standard
text.
<HTML> ‘= = =Traditional HTML Tags
<HEAD> <TITLE> ‘= = =Standard HTML
Welcome ‘= = =Standard Text
</TITLE></HEAD><BODY>
<% ‘= = =Active Server Script
Sub WriteWelcomeMessage()
Dim myGreeting
If Time >= #12:00:00 AM# And Time < #12:00:00 PM#
Then
myGreeting = “Good Morning !”
Else
myGreeting = “Hello !”
End If
Response.Write mygreeting
End Sub
%>
<% Call WriteWelcomeMessage %> ‘===Executing the Active
Server subroutine
</BODY></HTML>

Traditional HTML files consists of only HTML tags for page layout
and standard text to display text. The HTML tags are used to
create and display the content in the Web page. The difference
Jatin Soni : 9904181899 : Hi Friends.
Jatin Soni : 9904181899 : Hi Friends.

between the HTML and ASP files is


that ASP files simply expand the role of HTML tags by adding
scripting processing tags to control the HTML tags. The pages
with just HTML are a subset of ASP pages. To convert your
existing HTML pages to Active Server Pages, simply rename the
.HTM or .HTML file with an .asp file extension. The Internet
Information Server will see the file extension and automatically
interpret the ASP file.
Physical, Root and Virtual Directories :- Your ASP
application is simply a collection of text files located in a directory
or its subdirectories residing on the Web server. The base
directory for your ASP application is referred to as a virtual root.
The virtual root is what is referenced by the Web server as the
container that holds all the files needed for the ASP application.
Virtual directories are also used by the IIS Web server as file
containers. Virtual directories help prevent you from having to
know the exact files paths of files and to prevent users from
obtaining more information about the web server’s underlying
sub-systems.

Jatin Soni : 9904181899 : Hi Friends.


Jatin Soni : 9904181899 : Hi Friends.

ASP Scripting Languages


and HTML :- The heart of ASP programming is the processing
of server–side scripts. Server-side scripting provides the capability
to manipulate variables and application flow through procedure-
based coding, connect to a variety of external sources to retrieve
information, and control output to the Web browser. The scripting
language, now processed by both the Web server and Web client,
acts as an interpreter to executed the text-based Internet
protocol. To set the scripting language for an ASP, use the
LANGUAGE directive:
<%@ LANGUAGE = ScriptingLanguage RUNAT = Location %>
where ScriptingLanguage is the primary scripting language for
that page and Location is the location of script interpretation. An
ASP directive tells the IIS Web server how to interpret the
individual ASP file. The LANGUAGE directive is used to set the
proper interpreter for your primary scripting language for the
page. To use VBScript as the primary scripting language for a
given ASP page, use the LANGUAGE directive in the first line of
the ASP page.
<% LANGUAGE = “VBScript” RUNAT = “Server” %>
The LANGUAGE directive is just one of the directives available when
using ASP from the various ASP directives. By default, VBScript is
the default scripting language when you install IIS.

Jatin Soni : 9904181899 : Hi Friends.


Jatin Soni : 9904181899 : Hi Friends.

Creating, Developing
and Running an ASP Page

Running ASP Pages


To execute ASP pages on your computer. You need to be running a
web server. If you do not have a Web server that supports ASP
installed, first install the Web server. After you install a Web
server, you will be able to view ASP pages through your browser.
 Setting Up Personal Web Server
When creating a professional Web site, it is important that the
Web site run on a computer that has Windows NT Server or
Windows 2000 on their personal computers. However, not many
people run Windows NT server or Windows 2000 on their personal
computers. For this reason, Microsoft created a stripped-down
version of its professional Web server. This stripped-down version
is called a stripped-down version is called Personal Web Server
(PWS) and is intended to run on Microsoft window 95 or 98, or
Microsoft Windows NT Workstation. After you have a copy of the
PWS installed in your machine you run ASP pages.
Figure: Microsoft’s Personal Web Server setup wizard – Enter the
directory where you plan on placing your Web site’s files.

Jatin Soni : 9904181899 : Hi Friends.


Jatin Soni : 9904181899 : Hi Friends.

Jatin Soni : 9904181899 : Hi Friends.


Jatin Soni : 9904181899 : Hi Friends.

A Web page is requested from a


Web server with a URL, like the following:
http://www.InventoryReselleres/Inventory/ShowInventory.asp
The first part of the URL, www.InventoryReselleres.com, is the
domain name. This name identifies what Web server this Web site
exits on. The remainder of the URL determines what directory and
file the user is requesting. In the example, the user is requesting a
file named ShowInventory.asp from the /Inventory directory.
/Inventory/ShowInventory.asp is referred to as the virtual
address.
A virtual address is the directory and filename requested through
the URL. The Web server needs to map the virtual address to a
physical address. A physical address is a fully qualified path for
a specific file. You need to specify the root physical address.

Jatin Soni : 9904181899 : Hi Friends.


Jatin Soni : 9904181899 : Hi Friends.

Jatin Soni : 9904181899 : Hi Friends.

You might also like