An Overview of Classic ASP's Request Object

by Paul DeBrino


The Request Object receives the values that the client's browser passed to the server during an HTTP request.

When you surf to an address that begins with HTTP, the server you're visiting treats that as an "HTTP request"; you are in fact "requesting" that a particular web page is displayed to you. The same applies to any http hyperlinks that you click. A lot more information is being passed back and forth, between your PC and the server of the site you're visiting, than you may be aware of. This chunk of data is called a "request object". Along with the URL you've requested, information about your browser, IP address, the last URL you visited and more is being sent along with your request to view a particular web page. On the flip side, in addition to the web page you requested, the server also sends back server-related information in the same request object.

All this data gets passed in the HTTP request (a.k.a Request Object). Whether it was posted via an online form you filled in ..or.. embedded in the URL as name-value pairs, it all ends up in the Request object. How does that happen, you wonder? That's a helpful feature of Microsoft IIS (internet information services), whereas systems/languages such as Unix/Perl must parse/extract that information manually.

To make life a little simpler, the Request Object has several "collections". A collection is just a fancy word for grouping, segregating or classifying all of the information that's being exchanged. For example, input-capable fields on a form that is sent via "method=post" end up in collection "Form", while name-value pairs sent in the URL (or from a form sent via "method=get") end up in collection "QueryString", etc.

  • ClientCertificate: The values of fields stored in the client certificate that is sent in the HTTP request.
  • Cookies: The values of cookies sent in the HTTP request.
  • Form: The values of form elements in the HTTP request body.
  • QueryString: The values of variables in the HTTP query string.
  • ServerVariables: The values of predetermined server/environment variables.

The syntax is:
     Request[.collection|property|method](variable)

All request object variables can be accessed directly by calling Request(variable) without the collection name. In this case, the Web server searches the collections in the following order:

  1. QueryString
  2. Form
  3. Cookies
  4. ClientCertificate
  5. ServerVariables

If a variable with the same name exists in more than one collection, the Request object returns the first instance encountered. It is strongly recommended that, when referring to members of the ServerVariables collection, the full name be used. For example, rather than Request("AUTH_USER") use Request.ServerVariables("AUTH_USER").

The following is a script that will display the Request Form collection followed by the ServerVariables collection. Save this script as "view_request.asp". To see it work, code your form to have: ACTION="view_request.asp"

view_request.asp
<%@LANGUAGE="VBSCRIPT"%>
<% option explicit %>

<%
' Written by Paul DeBrino of Infinity Research and Development, Inc. (infinity-rd.com)
' Dumps all name-value pairs from POST action, then follows that with server variables.
%>

<%
' Sample of how to ensure visitor arriving on SSL secure channel:
' If (Request.ServerVariables("HTTPS") = "off") Then
'    Response.Redirect "https://" + Request.ServerVariables("SERVER_NAME") _
'      + Request.ServerVariables("PATH_INFO")
' End If
%>

<!-- Show greeting using selected server variables -->
<FONT SIZE=3>
Hello visitor from IP <%= Request.ServerVariables("REMOTE_ADDR") %>
<BR>Your browser identified itself as <%= Request.ServerVariables("HTTP_USER_AGENT") %>.
<P>

<!-- Show all form variables -->
<TABLE BORDER=2>
<TR>
 <TD><B>Form Variable</B></TD>
 <TD><B>Value</B></TD>

</TR>
<%
Dim Item
For Each Item In Request.Form
%>
<TR>
 <TD><FONT SIZE="-1"><%= Item %></FONT></TD>
 <TD><FONT SIZE="-1"><%= Request.Form(Item) %>&nbsp;</FONT></TD>

</TR>
<% Next %>
</TABLE>
 
</P><P>
 
<!-- Show all server variables -->
<TABLE BORDER=2>
<TR>

 <TD><B>Server Variable</B></TD>
 <TD><B>Value</B></TD>
</TR>
<% For Each Item In Request.ServerVariables %>

<TR>
 <TD><FONT SIZE="-1"><%= Item %></FONT></TD>
 <TD><FONT SIZE="-1"><%= Request.ServerVariables(Item) %>&nbsp;</FONT></TD>

</TR>
<% Next %>
</TABLE>
</P>
</FONT>

More Information


Paul DeBrino
Infinity Research and Development, Inc.
a Web Hosting and Graphic Design Company
www.infinity-rd.com



About the Author

From ASP101

Articles originally posted on ASP101.com

Comments

  • Hvad der er godt for hovedtelefonerne

    Posted by wanzixiao on 06/04/2013 06:25pm

    [url=http://www.beatsbydrdredanmark.weebly.com/]monster beats danmark[/url] Dr. Dre beats menes at være på listen over mange specialiserede service-hovedtelefoner kan gøre. Blandt det store udvalg vedrørende hovedtelefoner fra Monster Beats hovedtelefoner rundt næsten alle blandet Fahion mode især med exceptionelle egenskaber. De bestemt ikke efterlade en person typer et par dr dre lados.beats ofte sker i jagten på en højere visuel appel forekommer fremragende og charmerende.fordi jeg tror, at monster beats hovedtelefoner online shopping med hovedtelefoner i almindelighed en god elsker melodier, eller måske du nødt til at gå med musik i en krævende teknik, eller bare har brug for at få en Koronar nyde en god nats søvn , så du helt sikkert ønsker at få beruset for den mest pålidelige høj kvalitet udseende fremragende. [url=http://www.kbhretelefonerbillig.webstarts.com/]Køb høretelefoner billig[/url] Enhver Beats altid går, som vil komme op med en god måde undersøgelse. Det kunne gives, at disse headsets ikke kan være grundlæggende for dig, hvis du virkelig nyde populær musik, især dem, hvad personen virkelig nyde måde i processen. Det er udskiftelige pandebånd, bemærkelsesværdige gode, vil sammen med fuldstændig struktur bidrage til at gøre entusiaster sammen med fashionistas identisk tegn op, der vil disse smukke ørepropper. For virkelig at drage fordel af en persons sang alle nødt til at bruge en top-end sortiment af headset og også kombinere med bare Ogre Tilskyndelse tilfældigvis at være uden tvivl det faktum, at. Vedrørende afslapning, er de fleste en af de bedste, og giver en overordentlig fast golf greb om en persons trommehinder. Så igen, tæt forbundet med ville betyde disse ferie trygt og sikkert for din venture.. [url=http://www.beatsbydrdredanmark.webstarts.com/]Køb høretelefoner billig[/url] Give indsigt i LOCOG tænkning, og måske om ikke dets juridiske team vil reagere forskelligt på Dr Dre har Beats hovedtelefoner stunt, en talsmand sagde dengang: “Vores tilgang til håndhævelse i 2006 loven har altid været fornuftig, pragmatisk og forholdsmæssige.”Vi er nødt til at beskytte rettighederne for vores sponsorer, der har betalt for at få eksklusive associationer til legene i deres sponsorater kategorier. Vi er hård på kommercielt misbrug, men vi ønsker ikke at gøre noget for at dæmpe ægte begejstring og spænding om Games .

    Reply
  • Lightweight perceptive – Nike Free TR Befit in shoot up 2013 3 series

    Posted by Tufffruntee on 04/22/2013 07:08am

    Nike Manumitted TR Trim 3 unmistakable features is to use the trendy design: Nike Free 5 soles improved bending Scratch; new tractor layout making training more focused when; lighter ballast, the permeability is stronger, and more trendy shoe designs not only exhort shoes [url=http://markwarren.org.uk/goodbuy.cfm]nike free[/url] more comfortable wearing, barefoot training have compassion for incline, but also more in fashion appearance. Nike On the house TR Then 3 provides unequalled lateral perseverance, you can deceive the legs in the leg during training. Acrid vamp superiority breathable mesh, disgrace soap up's solitary delineate can be [url=http://fossilsdirect.co.uk/glossarey.cfm]nike huarache free[/url] seen under the aegis it. Lightweight, ragged, thin froth facts familiar at hand completely occasional seams, more flexible, support is stronger. Lack more mainstay, role of a training utilize, bubbles come in more parts of the neediness championing conformableness, bubble loose. Throw away stand-in say nothing moisture wicking counterfeit materials, unshiny on your feet, mitigate maintenance feet tiring and comfortable. Phylite [url=http://northernroofing.co.uk/roofins.cfm]nike free run 3[/url] midsole offers lightweight stupor sustained, outstanding durability and even outsole can do to greatly lower the all-embracing load of the shoe. Qianzhang pods on the outsole and heel-shaped Grassland rubber enhances the shoe multi-directional traction on different surfaces.

    Reply
Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • Live Event Date: May 7, 2014 @ 1:00 p.m. ET / 10:00 a.m. PT This eSeminar will explore three popular games engines and how they empower developers to create exciting, graphically rich, and high-performance games for Android® on Intel® Architecture. Join us for a deep dive as experts describe the features, tools, and common challenges using Marmalade, App Game Kit, and Havok game engines, as well as a discussion of the pros and cons of each engine and how they fit into your development …

  • The exponential growth of data, along with virtualization, is bringing a disruptive level of complexity to your IT infrastructure. Having multiple point solutions for data protection is not the answer, as it adds to the chaos and impedes on your ability to deliver consistent SLAs. Read this white paper to learn how a more holistic view of the infrastructure can help you to unify the data protection schemas by properly evaluating your business needs in order to gain a thorough understanding of the applications …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds