SlideShare a Scribd company logo
1 of 34
ASP (Active Server Pages)
A Technology to serve dynamic
pages
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
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
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
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
ASP and Various
Development
Framework
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
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
Working of ASP code
A Glance At Classic
ASP
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
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.
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
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
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
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
ASP Objects and
Components
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
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
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
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
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
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
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
Response.Cookies
Syntax:
Response.Cookies(name)= value
variablename= Request.Cookies(name)
Note: The Response.Cookies command
must appear before the <html> tag.
Setting
Cookies
Getting
Cookies
Response.AddHeader
Syntax:
response.AddHeader
name,value
Once a header has been
added, it cannot be removed.
Have two parameters
1. Name : name of new
header
2. Value : initial value of
header
Setting
Cookies
Checking Response
Header
Response.ContentType
Syntax
response.ContentType[=contenttype]
Parameter
1. Contenttype :A string describing
the content type.
Some Common content types are :
<%response.ContentType="text/HTML"%
>
<%response.ContentType="image/GIF"%
>
<%response.ContentType="image/JPEG"
%>
<%response.ContentType="text/plain"%>
Setting Content
Type
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
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
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
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.
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
Syntax
Output

More Related Content

Similar to asp_intro.pptx (20)

Asp.net
Asp.netAsp.net
Asp.net
 
Node js getting started
Node js getting startedNode js getting started
Node js getting started
 
Jsp
JspJsp
Jsp
 
Bt0083 server side programing
Bt0083 server side programing Bt0083 server side programing
Bt0083 server side programing
 
Lyudmila Zharova: Developing Solutions for SharePoint 2010 Using the Client O...
Lyudmila Zharova: Developing Solutions for SharePoint 2010 Using the Client O...Lyudmila Zharova: Developing Solutions for SharePoint 2010 Using the Client O...
Lyudmila Zharova: Developing Solutions for SharePoint 2010 Using the Client O...
 
Introduction to asp
Introduction to aspIntroduction to asp
Introduction to asp
 
DYNAMIC CONTENT TECHNOLOGIES ASP(ACTIVE SERVER PAGES)
DYNAMIC CONTENT TECHNOLOGIES ASP(ACTIVE SERVER PAGES)DYNAMIC CONTENT TECHNOLOGIES ASP(ACTIVE SERVER PAGES)
DYNAMIC CONTENT TECHNOLOGIES ASP(ACTIVE SERVER PAGES)
 
ASP.NET - Web Programming
ASP.NET - Web ProgrammingASP.NET - Web Programming
ASP.NET - Web Programming
 
Play framework
Play frameworkPlay framework
Play framework
 
Introduction to asp.net
Introduction to asp.netIntroduction to asp.net
Introduction to asp.net
 
Asp
AspAsp
Asp
 
540slidesofnodejsbackendhopeitworkforu.pdf
540slidesofnodejsbackendhopeitworkforu.pdf540slidesofnodejsbackendhopeitworkforu.pdf
540slidesofnodejsbackendhopeitworkforu.pdf
 
Introducing asp
Introducing aspIntroducing asp
Introducing asp
 
Asp.net architecture
Asp.net architectureAsp.net architecture
Asp.net architecture
 
Intro To Asp
Intro To AspIntro To Asp
Intro To Asp
 
A View about ASP .NET and their objectives
A View about ASP .NET and their objectivesA View about ASP .NET and their objectives
A View about ASP .NET and their objectives
 
Asp objects
Asp objectsAsp objects
Asp objects
 
Super billing asp.net
Super billing   asp.netSuper billing   asp.net
Super billing asp.net
 
Overview of ASP.Net by software outsourcing company india
Overview of ASP.Net by software outsourcing company indiaOverview of ASP.Net by software outsourcing company india
Overview of ASP.Net by software outsourcing company india
 
Programming languages asp.net
Programming languages asp.netProgramming languages asp.net
Programming languages asp.net
 

Recently uploaded

HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVRajaP95
 
Biology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxBiology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxDeepakSakkari2
 
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfAsst.prof M.Gokilavani
 
Churning of Butter, Factors affecting .
Churning of Butter, Factors affecting  .Churning of Butter, Factors affecting  .
Churning of Butter, Factors affecting .Satyam Kumar
 
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdfCCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdfAsst.prof M.Gokilavani
 
DATA ANALYTICS PPT definition usage example
DATA ANALYTICS PPT definition usage exampleDATA ANALYTICS PPT definition usage example
DATA ANALYTICS PPT definition usage examplePragyanshuParadkar1
 
main PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidmain PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidNikhilNagaraju
 
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerAnamika Sarkar
 
Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.eptoze12
 
Introduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECHIntroduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECHC Sai Kiran
 
Introduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptxIntroduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptxk795866
 
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionSachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionDr.Costas Sachpazis
 
Risk Assessment For Installation of Drainage Pipes.pdf
Risk Assessment For Installation of Drainage Pipes.pdfRisk Assessment For Installation of Drainage Pipes.pdf
Risk Assessment For Installation of Drainage Pipes.pdfROCENODodongVILLACER
 
Arduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.pptArduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.pptSAURABHKUMAR892774
 
complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...asadnawaz62
 

Recently uploaded (20)

HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
 
POWER SYSTEMS-1 Complete notes examples
POWER SYSTEMS-1 Complete notes  examplesPOWER SYSTEMS-1 Complete notes  examples
POWER SYSTEMS-1 Complete notes examples
 
Biology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxBiology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptx
 
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
 
Design and analysis of solar grass cutter.pdf
Design and analysis of solar grass cutter.pdfDesign and analysis of solar grass cutter.pdf
Design and analysis of solar grass cutter.pdf
 
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
 
Churning of Butter, Factors affecting .
Churning of Butter, Factors affecting  .Churning of Butter, Factors affecting  .
Churning of Butter, Factors affecting .
 
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdfCCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
 
DATA ANALYTICS PPT definition usage example
DATA ANALYTICS PPT definition usage exampleDATA ANALYTICS PPT definition usage example
DATA ANALYTICS PPT definition usage example
 
main PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidmain PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfid
 
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
 
Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.
 
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
 
Introduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECHIntroduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECH
 
Introduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptxIntroduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptx
 
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionSachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
 
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptxExploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
 
Risk Assessment For Installation of Drainage Pipes.pdf
Risk Assessment For Installation of Drainage Pipes.pdfRisk Assessment For Installation of Drainage Pipes.pdf
Risk Assessment For Installation of Drainage Pipes.pdf
 
Arduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.pptArduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.ppt
 
complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...
 

asp_intro.pptx

  • 1. ASP (Active Server Pages) A Technology to serve dynamic pages
  • 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
  • 10.
  • 11. A Glance At Classic ASP
  • 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
  • 26. Response.Cookies Syntax: Response.Cookies(name)= value variablename= Request.Cookies(name) Note: The Response.Cookies command must appear before the <html> tag. Setting Cookies Getting Cookies
  • 27. Response.AddHeader Syntax: response.AddHeader name,value Once a header has been added, it cannot be removed. Have two parameters 1. Name : name of new header 2. Value : initial value of header Setting Cookies Checking Response Header
  • 28. Response.ContentType Syntax response.ContentType[=contenttype] Parameter 1. Contenttype :A string describing the content type. Some Common content types are : <%response.ContentType="text/HTML"% > <%response.ContentType="image/GIF"% > <%response.ContentType="image/JPEG" %> <%response.ContentType="text/plain"%> Setting Content Type
  • 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