Active Server Pages

nervousripΑσφάλεια

5 Νοε 2013 (πριν από 3 χρόνια και 10 μήνες)

88 εμφανίσεις

Active Server Pages
(ASP)

A lesson.

By me.

Khyle Westmoreland.

I think…

What is ASP?


ASP

is

short

for

‘Active

Server

Pages’


Web

technology

developed

by

Microsoft


Allows

web

designers

to

create

dynamic

pages


ASP

is

server
-
based


The

code

is

executed

on

the

server,

not

the

client


Known

as

‘Server

Side

Scripting’

How it Works


Pages

are

coded

in

a

way

that

lets

the

server

know

that

it’s

meant

to

“parse”

it
.


This

is

done

by

way

of

a

special

HTML

code
:

<%
Code goes here

%>


These

tags,

as

you

may

recognise,

look

similar

to

that

of

HTML

tags

and

are

essentially

put

straight

into

normal

code
.

On
-
The
-
Fly


Each

time

a

page

is

loaded

it

is

executed



The

output

is

sent

straight

to

the

browser



Used

instead

of

changing

HTML

file

to

allow

variables

to

modify

the

output

Using ASP


Requires

a

server

running

Windows

and

IIS

(Internet

Information

Service)


IIS

is

a

web

server

which

serves

up

web

pages


There

is

a

‘plugin’

available

for

IIS

which

allows

the

server

to

execute

the

ASP

files


Costs

a

fair

bit

to

hire

from

a

hosting

company

How it Works

When

the

server

comes

across

these

tags,

it

reads

the

code

and

processes

it
.

For

example,

if

we

gave

it

code

that

told

it

to

output

the

word

“Khyle”,

it

would

do

just

that
.


For example:

<HTML>

<body>

My name is

<% response.write(“Khyle”) %>

</body>

</HTML>

<HTML>

<body>

My name is Khyle

</body>

</HTML>

ASP as a Language


Allows

many

different

languages

to

be

parsed


Most

popular

are

JScript

and

VBScript


ASP

parsing

plugin

in

turn

allows

plugins

to

execute

other

languages


PerlScript

and

Python

are

among

the

more

popular

plugins

Non
-
Micro$oft ASP


ASP predominantly a Microsoft technology


Normally need their OS and server to
parse it


However you can still process it on other
OSes
(why would you want to?!)


Chillsoft makes a plugin for Apache on
Unix to run ASP scripts

Open Source Equivalents


Thankfully

there

are

alternatives

to

MS


PHP

(Hypertext

Preprocessor)

is

the

open
-
source

alternative


No

choice

of

languages

in

PHP

(it

is

one

itself)


Will

run

on

any

OS

as

long

as

the

preprocessor

and

a

server

is

installed


Seen

as

an

industry

standard

PHP versus ASP


Industry

leaders

suggest

PHP

is

the

best

for

server
-
side

scripting


Primarily

because

it’s

Open

Source

and

will

work

with

most

server

applications


Recent

tests

show

PHP

is

faster

under

Linux

than

ASP

under

Windows


Preferred

technology

for

web

designers

and

hosting

companies

PHP versus ASP


Because

PHP

runs

under

Linux

it

is

cheaper

to

set

up



no

licensing

costs


Doesn’t

require

IIS



notorious

for

security

holes

and

general

hackability


Apache

is

the

Open

Source

web

server

and

will

run

PHP

flawlessly


Not

made

by

Microsoft



that’s

a

good

thing!

ASP Coding


There is a specific way to code ASP
scripts


Number of commands and syntax to learn


The use of VBScript makes programming
pages VERY similar to VB, as you will see
on the following page.

For example:

Common ASP Commands

response.write



outputs exactly what
you supply it with.

if



as

with

VB

it

allows

you

to

create

variable

outputs

dependent

on

inputs

for

/

next



again,

allows

you

to

create

iteration

in

a

similar

way

to

VB
.


Variables

<%


OutputText = “Khyle”

%>


This is a test to tell you that
the hidden word in the ASP
script is in fact

<% =OutputText %>.

Variables

<%


OutputText = now

%>


This is a test to tell you that
the hidden word in the ASP
script is in fact

<% =OutputText %>.

Advanced Use of ASP


ASP can be used to create some very
advanced scripts


Obviously it takes more coding than a
simple page


One example would be getting a page to
show the status of a server and its
network environment

In Summary


ASP is a web technology which can be
programmed into a normal HTML page
and is then executed (parsed) by the
server when a page is requested


There are many languages which can be
used with the ASP preprocessor


Quite complex scripts can be written with
enough knowledge of ASP


PHP is better than ASP

The End