To get information from the user, the ASP Request object is used.
A D V E R T I S E M E N T
Request Object
It is called a request when a browser asks for a page from a server, . To get information from the user,the ASP Request object is used. Its collections, properties,
and methods are described below:
Collections:
Collection
Description
ClientCertificate
Contains all the field values stored in the client certificate
Cookies
Contains all the cookie values sent in a HTTP request
Form
Contains all the form (input) values from a form that uses the post method
QueryString
Contains all the variable values in a HTTP query string
ServerVariables
Contains all the server variable values
Properties
Property
Description
TotalBytes
Returns the total number of bytes the client sent in the body of the request
Methods
Method
Description
BinaryRead
Retrieves the data sent to the server from the client as part of a post request and stores it in a safe array
Send query information when a user clicks on a link using QueryString
<html>
<body>
<form action="demo_simpleform.asp" method="post">
Your name: <input type="text" name="fname" size="20" />
<input type="submit" value="Submit" />
</form>
<%
dim fname
fname=Request.Form("fname")
If fname<>"" Then
Response.Write("Hello " & fname & "!<br />")
Response.Write("How are you today?")
End If
%>
</body>
</html>
O/P:
Your Name:
Results:
Hello Ravi!
How are you today?
Create a welcome cookie
<%
dim numvisits
response.cookies("NumVisits").Expires=date+365
numvisits=request.cookies("NumVisits")
if numvisits="" then
response.cookies("NumVisits")=1
response.write("Welcome! This is the first time you are visiting this
Web page.")
else
response.cookies("NumVisits")=numvisits+1
response.write("You have visited this ")
response.write("Web page " & numvisits)
if numvisits=1 then
response.write " time before!"
else
response.write " times before!"
end if
end if
%>
<html>
<body>
</body>
</html>
O/P:
Welcome!
This is the first time you are visiting this Web page.