2. Difference between Browser and
Server
Server
1. Software to serve documents on web.
2.Receive HTTP request and sends
appropriate HTTP response
3. Have area to store website documents
4.Eg Apache Server, Internet Information
Server, Heroku,AWS
Browser
1. Software to surf web pages and
content
2.Sends a HTTP request and receives
and HTTP response
3. Store data in cookies in local machine
4. Eg. Google Chrome , Firefox
3. Static
Pages
Designed with HTML , JS ,
CSS etc
Executed on browser
Data do not change with time
Are simple and takes less time
to load
Usually no involvement
of Database
4. Dynamic
Pages
Designed using Node.js ,
PHP , Python ,ASP ,
ASP.NET
Partially or fully executed
on Server.
Data may change with time
and action.
Require more time to load
due the server execution
and database calls
5. Simple Web
Page
A simple HTML page
may contain three
elements
1. HTML tags : to create the
structure of the web page
2. CSS code : to give styling
to the created structure
3. Scripting code : to give
interactivity to the
produced web page
index.html
7. Introduction ASP (Active Server Pages) is a
technology developed by Microsoft.
Pages using ASP are primarily developed
in JavaScript, VBScript , or PerlScript and
are integrated into the HTML of your Web
pages. The ASP code is compiled by the
server and the resulting output is
standard HTML. By using ASP, Web
pages can be dynamic, full of ever-
changing content, and browser
independent
8. Why we
choose
ASP
• Server-side ASP scripts can be used to store
HTML form information in a database,
personalize Web sites according to visitor
preferences, or use different HTML features
based on the browser.
• separate the design of your Web page from the
details of programming access to databases
and applications , allowing programmers and
Web designers to focus on what they do best.
• Can call other programs to do things like
access databases, serve different pages to
different browsers
12. Classic
ASP
A ASP page contain
1)HTML Tags -ASP can be regarded
as extension of a simple HTML file
2)Scripting Language -use to perform
operation on both client and server side .
Javascript and VBscript are available
scripting language here.
3)ASP Built-in Objects -encapsulation of
methods and user variable. Can have
properties, method, event, collections.
4)ASP Components - built in module to
handle some necessary tasks like database
access, file creation and exploration etc
13. Syntax for Classic
ASP
Normally a HTML file with scripting in
between.
Code to be executed in server side is
written between <% %>
Response.Write is a basic function to write
content on html document
Two type of Scripting language used
1. Client Side Scripting -runs on
browser - (by default Javascript)
2. Server Side Scripting -runs on
server - (by default VBscript)
Scripts in ASP files are executed on server.
14. Simple ASP
code
ASP files are identified by
.asp extension
The example contain the code
where only line between <% %>
will be processed in server side
OUTPUT of the file will be the
result text: “My First Webpage”
server.asp
15. Scripting in
ASP
Example to two type of scripting
is given
Client side scripting do not require
any parameter . We can give
language as prefered (by default
Javascript)
Server Side Scripting require
extra parameter of runat which
has two values “client” and
“server”
Client Side
Scripting
Server Side
Scripting
16. ASP
Variable
Variables are "containers" for
storing information.
We declare variable with Dim
(dimension) keyword
No data type need to be
explicitly define, declared as
variant type
Can use Option Explicit to
restricting yourself in declaring
variable only once
17. ASP
Array
An array variable is used to store
multiple values in a single variable.
Dim name(n) defines a array with
size of n and index starts from 0 to
n-1
Dim table(n,m) defines a
two- dimensional array
Multi-dimensional array of upto 60
dimensions can be defined in
VbScript
19. ASP
Objects
Objects are a way of encapsulating multiple
methods (they're like functions) and variables
in one easy to manage user-variable (called
objects)
Objects in ASP resemble other Object
Oriented Programming languages
An ASP Object can contain -
Collection , Properties , Methods , Events
Objects were created to combat the
increasing
complexity of programming.
It makes programming easier and your
code more human readable.
Object in ASP is created by passing a name string to the
Server.CreateObject function
20. ASP Built-in
Objects
Collection of predefined object explicitly
provided to user by IIS servers
An ASP Built-in Object can contain -
1. Collection- set of data to define the state
of object.
2. Properties -set of variables to modify the
data
3. Methods -set of function to operate
on predefined entities
4. Events : special function that operate
on triggering of certain event
Some built-in objects are
1. Request Object : object that have
HTTP response of client
2. Response Object : object that have
HTTP response of server
3. Server Object : object that
contain environment variable of
server
4. Session Object : object that
contain session control
information
21. Request
Object
Collections
:
1. QueryString: allows to retrieve value
for get request.
2. Form : allows to retrieve value from
post
request.
3. Cookies: allows to retrieve value stored
as cookies
4. ServerVariable : contain value of
predefined environment variable
Retrieves the values that the client browser
passes to the web server during an HTTP
request.
Can access data from both header and
body.
Use to issue server side processing like
form submission
Properties
:
1. TotalBytes: read-only property to specify
no. of bytes sent by client in HTTP request
22. Request.QueryString
The Request.QueryString
command is used to collect values
in a form with method="get".
Information sent from a form with
the GET method is visible to
everyone in address bar and has a
limit on size
Eg.https://www.ourdomain.com?s
erver.asp?name=Jhonny&pno=965
6566969
client.html
server.asp
23. Request.Form
The Request.Form command is
used to collect values in a form
with method="post".
Information sent with the
method=”POST” is invisible to
others and has no limits on the
amount of information to send.
Eg.https://www.ourwebsite.com/
server.asp
client.html
server.asp
24. Response
Object
Collection
:
1. Cookie :Sets a cookie value. If the
cookie does not exist, it will be
created, and take the value that is
specified
The Cookies collection is used to set or get
cookie values. If the cookie does not exist, it
will be created, and take the value that is
specified.
The Response object is used to send
output to the client from the web server.
ASP Properties need to be inserted after
<%@ LANGUAGE="VBSCRIPT"%> directive,
but before the first HTML tag.
Gives potent control over what you send
to client over the web
25. Response
Object
Methods
:
1. AddHeader : add a HTTP header
and value to the response.
2. AppendToLog: add specific string at
the
end of server log
3. Redirect : redirect the user to
different URL
4. End : stops processing a script and
return
current result
Properties
:
1. ContentType :sets the HTTP
content type for response object
2. Expires : sets how long the page will
be
cached in browser
3. IsClientConnected : specifies
whether client is still connected to
server or not
4. Status : specifies the status send by
server
29. Server
Object
Methods
:
1. CreateObject -Creates an instance of
an object
2. Execute -Executes an ASP file from inside
another ASP file
3. Transfer -Sends (transfers) all the
information created in one ASP file to
a second ASP file
4. URLEncode : Applies URL encoding rules
to a
specified string
The Server object is designed to help you
carry out various tasks on the server.
It is used to access properties and methods
on the server.
Properties
:
1. ScriptTimeout -Sets or returns the
maximum number of seconds a script
can run before it is terminated
30. Server.CreateObject
The CreateObject method creates an
instance of an object.
Syntax:
Server.CreateObject(progID)
progID : The type of object to create
Creating
Object
Destroying
Object
31. Session
Object
A Session object stores information about,
or change settings for a user session.
Collections
:
1. Contents :Contains all the items
appended to the session through a
script command
2. StaticObjects : Contains all the
objects appended to the session
with the HTML
<object> tag
Methods
:
1. Abandon : Destroys a user session
2. Contents.Remove: Deletes an item
from the Contents collection
3. Contents.RemoveAll:Deletes all
items from the Contents collection
32. Session
Object
Properties
:
1. SessionID : returns a unique id for
each user generated at server
2. Timeout : set timeout period for
session
3. LCID : return location integer according
to which date , time other content can
be set
Events
:
1. Session_OnEnd : occurs when
session end
2. Session_OnStart : occurs when
session start.
33. Session
Event
Session Events are the special type of
subroutines that are fired when a
specific event takes place.
ASP provide two basic events that can be
as
1. Session_OnStart :
Fired when the server is first calls
from
client session.
1. Session_OnEnd:
Fired when the server closes the
client session
Syntax