logo
g Text Version
Auto
Beauty & Self
Books & Music
Career
Computers
Education
Family
Food & Wine
Health & Fitness
Hobbies & Crafts
Home & Garden
Money
News & Politics
Relationships
Religion & Spirituality
Society & Culture
Sports
Travel & Leisure
TV & Movies

dailyclick
Bored? Games!
Postcards
Astrology
Take a Quiz
Rate My Photo

new
Journals
Folklore and Mythology
Business Coach
Marriage
Senior Living
Ethnic Beauty
Adolescence


dailyclick
All times in EST

Autism Spectrum Disorders: 4:00 PM

Full Schedule
g
g ASP Site
Editor Wanted
BellaOnline's ASP Editor

g

Using the REQUEST Object
Guest Author - Linawaty


Response object is used to request information either from the user (by means of form) or from the server.

There are many methods assigned to it.

Some of them that are used mostly are :

1. Request.form("parameter")
This is used to get information passed from a FORM with the method of "POST".

Example:

<form name="form_name" method="post" action="this_page.asp">
   <input type="text" name="customer_name" value="">
   <input type="password" name="customer_password" value="">
   <input type="submit" name="button" value="Submit">
</form>

when you click the "Submit" button, those information will be sent to "this_page.asp". All you have to do is to catch that variable on that page as follow :

<%
response.write "Customer Name : " & request.form("customer_name")
%>

Note that you can store that data into a variable first.

<%
Dim password

Password = request.form("customer_password")
response.write "Customer Password : " & password
%>

Also please note that a "password" field’s data will be sent as if it is text data. The "***" or "ooo" while typing is for visual security only.


2. Request.querystring("parameter")
Basically, you would find this quite the same as request.form("parameter"). The difference is that this can be obtained not only from FORM with the method of "GET" but also from direct url typing.

Example1: FORM

<form name="form_name" method="get" action="this_page.asp">
<input type="text" name="customer_name" value="">
<input type="password" name="customer_password" value="">
<input type="submit" name="button" value="Submit">
</form>

when you click the "Submit" button, those information will be sent to "this_page.asp" through the url (see page’s url).

Example2: URL
You can just type in the parameter and its value directly in the address bar. The format is as follow :

page_name.asp ? parameter = value [& parameter = value ...]

this_page.asp?customer_name=Linawaty&customer_password=password

Either way, all you have to do is to catch that variable as follow :

<%
response.write "Customer Name : " & request.form("customer_name")
%>

Note that you can store that data into a variable first.

<%
Dim password
Password = request.form("customer_password")
response.write "Customer Password : " & password
%>

Also please note that a "password" field’s data will be sent as if it is text data. The "***" or "ooo" while typing is for visual security only. You still can only view it in the url.


3. Request.servervariables("predefined_server_variable")
Unlike the other two above, you don’t have to get some values first before retrieving server variables. All these information are located at server, available for request anytime you need it, such as :

a. browser information
<%=request.servervariables("HTTP_USER_AGENT")%>

b. Local IP address
<%=request.servervariables("LOCAL_ADDR")%>

c. URL
<%=request.servervariables("URL")%>

d. Request method
<%=request.servervariables("REQUEST_METHOD")%>

e. File name
<%=request.servervariables("SCRIPT_NAME")%>

You can also loop through all of the server variables like this:

<%
for each x in Request.ServerVariables
response.write x & "<br>"
next
%>



This site needs an editor - click to learn more!

RSS | Related Articles | Previous Features | Site Map

Add Using+the+REQUEST+Object to Twitter Add Using+the+REQUEST+Object to Facebook Add Using+the+REQUEST+Object to MySpace Add Using+the+REQUEST+Object to Del.icio.us Digg Using+the+REQUEST+Object Add Using+the+REQUEST+Object to Yahoo My Web Add Using+the+REQUEST+Object to Google Bookmarks Add Using+the+REQUEST+Object to Stumbleupon Add Using+the+REQUEST+Object to Reddit


Content copyright © 2009 by Linawaty. All rights reserved.
This content was written by Linawaty. If you wish to use this content in any manner, you need written permission. Contact BellaOnline Administration for details.

g


For FREE email updates, subscribe to the ASP Newsletter


Past Issues


print
Printer Friendly
bookmark
Bookmark
tell friend
Tell a Friend
forum
Forum
email
Email Editor

g features
Best uses for RSS

RSS and its future.

Force Download Dialog box with ASP

Archives | Site Map

forum
Forum
email
Contact

Past Issues
memberscenter

jobs
what
job title, keywords
where
city, state or zip
jobs by job search


vote
Growing a Garden
Veggies and Flowers
Veggies Only
Flowers Only
No Garden

g


| About BellaOnline | Privacy Policy | Advertising | Become an Editor |
Website copyright © 2009 Minerva WebWorks LLC. All rights reserved.


BellaOnline Editor