Chapter_2 - Sushant`s Technical Articles

Download Report

Transcript Chapter_2 - Sushant`s Technical Articles

Chapter 2
Interacting with the Customer
Objectives


Use of Response Object.
Use of Request Object.
Response Object



Is an Built-in ASP object.
Used to send dynamic content from an ASP
page. i.e represents information sent from
web server to web browser.
Method Used:


Write – used to o/p values of functions,
variables or string literals.
End – used to stop execution of a script.
Request Object


Represents all content sent from the web
browser to a web server.
Collections:
1.
2.
3.
4.
Query string collection.
Form collection
ServerVariables collection
Cookies collection.
1. Using Query string:


Query string is the portion of the URL that
appears after a question mark.
Ex:
http://search.yahoo.com/bin/search?p=active+server+page

It is used to pass information to server
from browser.
2. Form Collection



Is an In-Built Asp object.
HTML forms are used to enable customer
to register at your web site / or to accept
credit card information.
To retrieve information from such forms
we use form collection of request object.
3. Servervariables Collection


Contain assortment of variables that
represent browser headers 7 properties of
the web server.
Servervaribles collection used to
determine:




Name of current asp page.
Last page customer visited .
IP address
Browser type.
Retrieve Name of current asp page

Variables used are:



SCRIPT_Name – Virtual Path
PATH_TRANSLATED – Physical path.
MapPath() – to translate virtual path to
physical path.
Retrieve Name of last page visited:



Used to return the value of the browser
REFERER header.
Older browsers do not support this variable.
Used as “HTTP_REFERER”.
Retrieving customer’s IP Address & Browser
Type:


IP Address - Variable used is “REMOTE_ADDR”.
Browser type–HTTP_USER_AGENT.