Paper on ASP

chunkyscreechΔιακομιστές

4 Δεκ 2013 (πριν από 3 χρόνια και 8 μήνες)

118 εμφανίσεις


-

1

-


















A
ctive
S
erver
P
ages


Ben Huffnagle

Web Programming

Dr. Girard

11:00a
-
11:50a MWRF



-

2

-

Introduction



We live in a dynamic world. The society that we live in is based on instant
gratification and getting information as soon as possible. With

this in mind, it is clear
that without changing, any form of media will become obsolete in a very short period of
time. The fact that websites are one of the more technically advanced forms of media
does not exclude them from this rule. In fact, by bein
g as technological as they are, more
strain is put on websites to be up to the minute up to date. The news is at 6 and 11, the
newspaper comes in the morning, but websites are on demand twenty four hours a day,
seven days a week, and so must be updated ve
ry often, in some cases, every time they are
requested. To hire someone to do this job would not only take a lot of time and
manpower, but also drain a company of resources and bore the hell out of talented
programmers. So how then is the Internet kept u
p to date as needed? One of the most
common ways this is done is by using a technology called Active Server Pages, or ASP,
to dynamically create html documents to be displayed whenever requested. ASP uses
scripting languages, either VBScript or JScript,
to gather information and display a
website that is unique to this instance of it being called, changing the website with such
things as the time, date, browser information, or information about a specific user. With
this, the Internet is able to cope wit
h the constant demand for up to date information
without requiring millions of pissed off nerds to maintain it constantly.


-

3

-

Background




ASP was created by Microsoft to help developers keep up with the demand for
dynamically updated web pages without havi
ng to go through the hassle of rebuilding the
site, as CGI or ISAPI dlls required (Kirtland). Originally revealed to the world on July
16th, 1996, ASP was codenamed Denali by Microsoft. Beta testing started in November
1996, and ASP v1.0 hit the shelves
on December 12, 1996. It took being bundled with
Microsoft's Internet Information Server v3.0 in March of 1997 for ASP to catch on and
gain recognition, however (Buser). As ASP began to catch on with developers, Microsoft
released version 2.0 in 1998, co
upled with IIS 4.0 and their Personal Web Server 4.0.
Finally, with Windows 2000 came the latest version of regular ASP, version 3.0 (Buser).
The latest development for ASP is the release of ASP.NET, which provides the tools of
ASP, but built on the new
Microsoft .NET architecture. With use expanding and
popularity growing, ASP is quickly coming to dominate the World Wide Web.


-

4

-

Main Body

What is ASP?



Very simply, ASP is a tool used to dynamically create HTML documents. This is
done by embedding sectio
ns of a scripting language, usually JScript or VBScript, inside
an HTML document. When the document with the scripting language is called, the
server, using ASP, dynamically creates a new HTML document by interpreting the
scripts and altering the HTML as
needed. All the processing is done server side, and is
done each time the document is called, so a high degree of personalization and
customization can be done to a website to accommodate the preferences of the individual
user. This can mean something si
mple, such as displaying the time or detecting what
kind of browser the person is using, or can be as complicated as calling up a database
based on preferences previously selected by an individual user. Microsoft, as it normally
does, worked very hard to
make ASP compatible with a lot of its other products, and so
doing such complex operations as getting information from a database has been
simplified when accessing Access or SQL databases. With this ease of use and the ability
to create unique sites for
unique users on the fly, ASP has become a widely used tool of
the Web Development community.


-

5

-

Just how does ASP work?



Instead of replacing HTML as a whole and making a new way of making web
pages, ASP simply seeks to complement existing HTML and add the
ability to create
dynamic web pages, as opposed to the standard static HTML documents that existed
before.


The tools used for this job are pre
-
existing scripting languages, VBScript and
JScript, both Microsoft products. Incorporation of the scripting lan
guages is quite
simple, all you have to do is make your HTML document as you normally would, and
whenever you want to include some ASP code, you just enclose it in <% at the beginning
and %> at the end. Whatever is contained in these tags will be handled
by the server and
appear to the user as a normal HTML document. An easy example of this is:







This code will cause the browser to display the HTML normally, and then where
it says <% = Time %>, the current time will be displayed whenever the page is
requested.
An important fact to remember is that the time that would be displayed will be the time of
the server, not the time the user may have. This is because all processing of the scripts is
done server side, but that will be discussed in more depth
later. While this is a neat trick,
it only scratches the surface of the capability of ASP. The next example shows one of the
more impressive aspects of ASP: the ability to link dynamically with a database.

<HTML>

<HEAD><TITLE>The Punctual Web Server</TITLE></HEAD>

<BODY>


<H1>Welcome</H1>


In Webserverland, the time is exactly <% = Time %>

</BODY>

</HTML>

(Code taken

from http://www.wrox.com the companion to "Beginning Active Server Pages 3.0)


-

6

-























While this looks, and is
, fairly complicated, it would simply display the titles of
movies that are listed in a database. By allowing the developer to link a web page
<%Option Explicit%>

<HTML>

<HEAD>

<TITLE>Testing our connection</TITLE>

</HEAD>

<BODY>


<%

Dim adOpenForwardOnly, adLockReadOnly, adCmdTable

adOpenForwardOnly = 0

adLockReadOnl
y = 1

adCmdTable = 2


Dim objConn, objRS

Set objConn = Server.CreateObject("ADODB.Connection")

Set objRS = Server.CreateObject("ADODB.Recordset")


Dim strDatabaseType

'Choose one of the following two lines, and comment out the
other

strDatabaseType = "Acc
ess"

'strDatabaseType = "MSDE"


'Now we use this selection to open the connection in the
appropriate way

If strDatabaseType = "Access" Then


objConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _


"Data Source=C:
\
datastores
\
Movie2000.mdb;" & _


"Persist Security Info=False"

Else


objConn.Open "Provider=SQLOLEDB;Persist Security Info=False;"
& _


"User ID=sa;Initial Catalog=Movie;" & _


"Initial File Name=C:
\
MSSQL7
\
Data
\
Movie2000.mdf"

End If


objRS.Ope
n "Movies", objConn, adOpenForwardOnly,
adLockReadOnly, adCmdTable


While Not objRS.EOF


Response.Write objRS("Title") & "<BR>"


objRS.MoveNext

Wend


objRS.Close

objConn.Close

Set objRS = Nothing

Set objConn = Nothing

%>


</BODY>

</HTML>

(Code taken fro
m http://www.wrox.com the companion to "Beginning Active Server Pages 3.0)


-

7

-

dynamically with a database, it cuts down on the amount of upkeep that will be needed.
Say, for example, that t
his is a web page put up by a local video store to list all of the
movies that it currently has in stock. If well done, the database could be linked with the
check out counters and the store could easily have a listing online of what movies are
currently
available, which would be valid every time the window is opened. If the last
copy of
The Matrix

was checked out ten seconds ago, you would be able to go online and
see that, without having to go to the video store and find out that you just missed it.
Ag
ain, a fairly simple explanation, but it shows the power that is easily available with
this technology.


-

8

-

What are the advantages of ASP?



Obviously ASP is very powerful and very useful for many things, but there are a
few key advantages to using this tech
nology. These are: ease of use, universal client
-
side
compatibility, and the ability to use components from other languages.


ASP is extremely easy to use if you know the scripting languages, as has been
demonstrated by the examples I have shown. The lac
k of overhead makes it easy to
include in HTML documents, as you simply need to ensure that ASP is installed on the
server and then insert your scripts in the tags. The only problem with this is that you
need to know the scripting languages, but these are

not difficult to learn, especially
VBScript.


One of the biggest advantages is the fact that once you make your ASP page,
everyone can see it clearly, regardless of their location, browser, or operating system.
This is due to the fact that all of the pro
cessing of the scripts is done server
-
side. This is
very important because it ensures maximum exposure for your website, with no
limitations put on your potential viewers. The only disadvantage is that you have to
ensure that your server is ASP compatibl
e, which is not much of a problem. All recent
Windows servers come with ASP bundled with Microsoft's IIS, but the open source
community has PHP, which does many of the same things and works on all operating
systems. While other options exist for this pur
pose, it does not diminish the power of
ASP.


Another powerful tool that ASP is that is allows the developer to include
components from other languages. This allows for almost unlimited functionality to be

-

9

-

included in the web page with the only limitation

being that you have to know the other
languages, which is usually a given.


-

10

-

A short aside on ASP.Net



Microsoft's most recent venture in the software field is its new .net architecture.
The overall goal has been to make all of the Microsoft more compati
ble with other
systems, and to make everything more web
-
based. ASP, being a Microsoft product, is no
exception and has been adapted with this framework in mind. The differences to the
developer are minimal, but with the new architecture, a buffer between

the language and
the operating system, making it even more compatible with other systems.


-

11

-

Summary



ASP is a powerful tool that has helped break the static web page. By dynamically
creating pages, the information is more up to date, personalized, and ge
nerally more
relevant. With the many tools provided by ASP, development of a more useful internet
has become very possible, without the need for hoards of angry programmers working
around the clock on tedious projects. The ease of use and power of ASP ha
s made it an
invaluable tool in the web development community, and should remain a vital part of the
Internet for a while.


-

12

-

Works Consulted and Cited


Bruser, David. Kauffman, John. LLibre, Juan T. Francis, Brian. Sussman, David. Uliman,

Chris. Duckett, J
on. "Beginning Active Server Pages 3.0". Wrox Press, Ltd.

Birmingham, UK. 1999


"Introduction to ASP". http://www.w3schools.com/asp/asp_intro.asp


Kirtland, Mary. "Writing a smart server Application with Denali".

http://www.microsoft.com/mind/1296/denali
.asp


"Microsoft .Net Basics". http://www.microsoft.com/net/basics/