HTTP Server Variables

<% @ Language="JavaScript" %>

<HTML>

etc...

<TABLE>
    <TR>
        <TD>VARIABLE</TD>
        <TD>VALUE</TD>
    </TR>
<%
var svrVars = new Enumerator(Request.ServerVariables);

// enumerator through the svrVars collection
// by using svrVars.moveNext() until we reach svrVars.atEnd()
for (svrVars; !svrVars.
atEnd(); svrVars.moveNext()) { // if not at the end move to next "collection"
%>
    <TR>
        <TD>
        <% = svrVars.item() %>
        </TD>
        <TD>
        <%
        // if there is no Value then write a blank space so that a cell can be formed in the table
        if (Request.ServerVariables(svrVars.item()) == "") Response.write("&nbsp;");
        else Response.write(Request.ServerVariables(svrVars.item()));
        %>
       </TD>
    </TR>

<
%
}
%>
</TABLE>

svrVars.item() - PATH_INFO
Request.
ServerVariables(svrVars.item()) -  /jscript/week10/asp/srvvar.asp

ServerVariables - collection retrieves the values of predetermined environmental variables.

Request.ServerVariables (server environment variable)

Where (server environment variable) specifies the name of the server environment variable to retrieve.

It can be one of the following values for example:
QUERY_STRING - Query information stored in the string following the question mark (?) in the HTTP request.

Enumerator

Description

Provides a way to enumerate items in a collection.

Syntax

new Enumerator(collection)

The collection argument is any collection object.

Remarks

Collections differ from arrays in that the members of a collection are not directly accessible. Instead of using indices, as you would with arrays, you can only move the current item pointer to the first or next element of a collection.

The Enumerator object provides a way to access any member of a collection and behaves similarly to the For...Each statement in VBscript, which repeats a group of statements for each element in an array or collection.

For Each element In group
    [statements]
    [Exit For]
    [statements]
Next [element]

array
A set of sequentially indexed elements having the same type of data. Each element of an array has a unique identifying index number. Changes made to one element of an array do not affect the other elements.
 
collection
An object that contains a set of related objects. An object's position in the collection can change whenever a change occurs in the collection; therefore, the position of any specific object in the collection may vary.