3.4 Request Object

Retrieves the values that are sent by the client browser, to the server during an HTTP request.

3.4.1 Cookies property

Returns the collection object of the cookies sent in an HTTP request.

Syntax

Request.Cookies

Type

Collection object.

Attributes

Read-only.

3.4.2 Example

See sample in Value property.

3.4.3 Form property

Returns the collection object containing the values of form elements posted to the HTTP request body using the Post method.

Syntax

Request.Form

Type

Collection object.

Attributes

Read-only.

Example

This sample returns the collection object containing the values for the form form1 and allows the user to enter the values for that form.

<%
On Error Resume Next

’Returns the form collection object containing values for form1
If Request.Form("form1") = "" Then

’This script allows you enter data on an HTML form. %>

<form METHOD="POST" ACTION="form.asp">
<p>Customer ID:

<p><input TYPE="Numeric" SIZE="5" MAXLENGTH="5" Customer
ID="custid"><br>
<p>Products you require: (you may select more than one)
<select NAME="prod" MULTIPLE SIZE="3">
<option> Product 1
<option> Product 2
<option> Product 3
</select>

<p> Select the payment mode
<p> <Input TYPE = Radio Name ="payment" Value = "Credit Card"
Checked>Credit Card
<br><Input TYPE = Radio Name ="payment" Value = "check" >Check
      
<p><input TYPE="SUBMIT" VALUE="Submit Form"><input
TYPE="RESET" VALUE="Reset Form">
</form>
<%  End If %>

3.4.4 QueryString property

Returns the collection object containing the values of the variables present in the HTTP query string.

Syntax

Request.QueryString

Type

Collection object.

Attributes

Read-only.

Remarks

The HTTP query string is specified by the values following the "?" (question mark).

3.4.5 ServerVariables property

Returns the collection object containing the values of preset environment variables.

Syntax

Request.ServerVariables

Type

ServerVariables.

Attributes

Read-only.

Remarks

Lists all the server variables.

Example

This sample returns the list of server variables and the corresonding values.

<%’Prints the server variables and the value in tabular form%>
<Table Border="2">

<tr>
<td><b>Server Variable</b></td>
<td><b>Value</b></td>
</tr>

<%’Retrieves the value for each server variable%>

<tr>
<%’name is the environment variable for retrieving the value
of each server variable %>
<%  For Each name In Request.ServerVariables %>
<td><%=name %></td>
<td><%=Request.ServerVariables(name)%></td>
</tr>

<% Next %>
</table>