Request.ServerVariables() Collection

Audience Level

Beginner and above

Introduction

The following is a live enumeration of ASP's “Request.ServerVariables” collection showing all available key names and their item values. I built it because I often forget the key names. Although not filtered in any way, I don't consider there to be any security-sensitive information here. This page has the additional benefit that you can sometimes get to see what search engines and other robots submit to webservers if you can get access to a remotely cached version of this page, e.g. Google's cache of this page.

The Output

ALL_HTTP
HTTP_CACHE_CONTROL:no-cache HTTP_CONNECTION:close HTTP_PRAGMA:no-cache HTTP_ACCEPT:Accept: application/xhtml+xml,text/html;q=0.9,text/plain; HTTP_ACCEPT_CHARSET:ISO-8859-1,utf-8;q=0.7,*;q=0.7 HTTP_ACCEPT_ENCODING:gzip HTTP_ACCEPT_LANGUAGE:en-us,en;q=0.5 HTTP_HOST:andrewu.co.uk HTTP_USER_AGENT:CCBot/1.0 (+http://www.commoncrawl.org/bot.html)
ALL_RAW
Cache-Control: no-cache Connection: close Pragma: no-cache Accept: Accept: application/xhtml+xml,text/html;q=0.9,text/plain; Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Accept-Encoding: gzip Accept-Language: en-us,en;q=0.5 Host: andrewu.co.uk User-Agent: CCBot/1.0 (+http://www.commoncrawl.org/bot.html)
APPL_MD_PATH
/LM/W3SVC/9015/ROOT
APPL_PHYSICAL_PATH
C:\Domains\andrewu.co.uk\wwwroot\
AUTH_PASSWORD
AUTH_TYPE
AUTH_USER
CERT_COOKIE
CERT_FLAGS
CERT_ISSUER
CERT_KEYSIZE
CERT_SECRETKEYSIZE
CERT_SERIALNUMBER
CERT_SERVER_ISSUER
CERT_SERVER_SUBJECT
CERT_SUBJECT
CONTENT_LENGTH
0
CONTENT_TYPE
GATEWAY_INTERFACE
CGI/1.1
HTTPS
off
HTTPS_KEYSIZE
HTTPS_SECRETKEYSIZE
HTTPS_SERVER_ISSUER
HTTPS_SERVER_SUBJECT
INSTANCE_ID
9015
INSTANCE_META_PATH
/LM/W3SVC/9015
LOCAL_ADDR
69.93.118.189
LOGON_USER
PATH_INFO
/tools/servervariables/default.asp
PATH_TRANSLATED
C:\Domains\andrewu.co.uk\wwwroot\tools\servervariables\default.asp
QUERY_STRING
REMOTE_ADDR
38.103.63.16
REMOTE_HOST
38.103.63.16
REMOTE_USER
REQUEST_METHOD
GET
SCRIPT_NAME
/tools/servervariables/default.asp
SERVER_NAME
andrewu.co.uk
SERVER_PORT
80
SERVER_PORT_SECURE
0
SERVER_PROTOCOL
HTTP/1.1
SERVER_SOFTWARE
Microsoft-IIS/6.0
URL
/tools/servervariables/default.asp
HTTP_CACHE_CONTROL
no-cache
HTTP_CONNECTION
close
HTTP_PRAGMA
no-cache
HTTP_ACCEPT
Accept: application/xhtml+xml,text/html;q=0.9,text/plain;
HTTP_ACCEPT_CHARSET
ISO-8859-1,utf-8;q=0.7,*;q=0.7
HTTP_ACCEPT_ENCODING
gzip
HTTP_ACCEPT_LANGUAGE
en-us,en;q=0.5
HTTP_HOST
andrewu.co.uk
HTTP_USER_AGENT
CCBot/1.0 (+http://www.commoncrawl.org/bot.html)

Source Code

Note: As with all scripts on this site, the following source is JScript ASP

<%
/*
Function: enumerateCollection()
Description:
Returns:
History:
20050503 0124BST    v1      Andrew Urquhart     Created
*/

function enumerateCollection(objCollection) {
    try {
        var objO = [];
        for (var objItem = new Enumerator(objCollection); !objItem.atEnd(); objItem.moveNext()) {
            var strKeyName  = objItem.item();
            var strKeyValue = objCollection(strKeyName).Count() ? objCollection(strKeyName).Item(1) : "";
            objO.push("<dt>" + Server.HTMLEncode(strKeyName) + "</dt><dd>" + Server.HTMLEncode(strKeyValue) + "</dd>");
        }
        return "<dl>" + objO.join("") + "</dl>";
    }
    catch (err) {
        throw new Error(err.number, "Function enumerateCollection() failed with parameters objCollection=\"" + objCollection + "\". Message=\r\n" + err.description);
    }
}




Response.Write(enumerateCollection(Request.ServerVariables));

/* OTHER APPLICABLE COLLECTIONS */
//Response.Write(enumerateCollection(Request.Form));
//Response.Write(enumerateCollection(Request.QueryString));
%>

Download

Download the source directly.

Advertisement

Feedback

Voting Panel
Is this useful?
or
Could this be improved?
or
Did you find any bugs?
or
Rate this utility: (0 = poor, 5 = very good)
Answers are anonymous, only the combined totals are stored. Uses cookies.