List of Request.ServerVariables

The ServerVariables are a collection of environment variables and request header information. Information relates to the client and the server.

Information available in the ServerVariables includes the server and client IP addresses and the client browser details.

VariableDescription
ALL_HTTPReturns all of the HTTP headers sent by the client. Always
prefixed with HTTP_ and capitalised
ALL_RAWReturns all headers in a raw format
APPL_MD_PATHReturns the meta base path for the application for the ISAPI
DLL
APPL_PHYSICAL_PATHReturns the physical path corresponding to the meta base
path
AUTH_PASSWORDReturns the value entered in the client’s authentication
dialog
AUTH_TYPEThis is the authentication method which is used by the
server when it validates users as they attempt to access a protected script.
AUTH_USERReturns the raw authenticated user name
CERT_COOKIEReturns the unique ID for the client certificate as a string
CERT_FLAGSbit0 is set to 1 if the client certificate is present and
bit1 is set to 1 if the cCertification authority of the client certificate is
not valid
CERT_ISSUERReturns the issuer field of the client certificate
CERT_KEYSIZEThe number of bits in the Secure Sockets Layer connection
key size. For example, 128.
CERT_SECRETKEYSIZEThe number of bits in the server certificate private key.
For example, 1024.
CERT_SERIALNUMBERSerial number field of the client certificate.
CERT_SERVER_ISSUERIssuer field of the server certificate.
CERT_SERVER_SUBJECTSubject field of the server certificate.
CERT_SUBJECTSubject field of the client certificate.
CONTENT_LENGTHThe length of the content as reported by the client.
CONTENT_TYPEThe data type of the content. Used with queries that have
attached information, such as the HTTP queries POST and PUT.
GATEWAY_INTERFACEThe revision of the CGI specification used by the server.
Format: CGI/revision.
HTTP_This is the value stored in the header HeaderName. Any
header other than those listed in this table must be prefixed by “HTTP_” in
order for the ServerVariables collection to retrieve its value.Note: The server interprets any underscore (_) characters in HeaderName
as dashes in the actual header. For example if you specify HTTP_MY_HEADER, the
server searches for a header sent as MY-HEADER.
HTTPS_KEYSIZEThe number of bits in the Secure Sockets Layer connection
key size. For example, 128.
HTTPS_SECTRETKEYSIZEThe number of bits in the server certificate private key.
For example, 1024.
HTTPS_SERVER_ISSUERIssuer field of the server certificate.
HTTPS_SERVER_SUBJECTSubject field of the server certificate.
INSTANCE_IDThis is the ID for the IIS instance in textual format. If
the instance ID is 1, it appears as a string.
INSTANCE_META_PATHThe metabase path for the instance of IIS that responds to
the request.
LOCAL_ADDRThe Server Address on which the request came in. Especially
useful on a server which is multi-homed, as it provides details as to on which
interface the request came in on.
LOGON_USERThe Windows account that the user is logged into.
PATH_INFOExtra path information as given by the client. You can
access scripts by using their virtual path and the PATH_INFO server variable.
If this information comes from a URL it is decoded by the server before it is
passed to the CGI script.
PATH_TRANSLATEDA translated version of PATH_INFO that takes the path and
performs any necessary virtual-to-physical mapping.
QUERY_STRINGQuery information stored in the string following the
question mark (?) in the HTTP request.
REMOTE_ADDRThe IP address of the remote host making the request.
REMOTE_HOSTThe name of the host making the request. If the server does
not have this information, it will set REMOTE_ADDR and leave this empty.
REMOTE_USERReturns an unmapped user-name as a string sent in by the
user
REQUEST_METHODThe method used to make the request. For HTTP, this is GET,
HEAD, POST, and so on.
SCRIPT_MAPGives the base portion of the URL.
SCRIPT_NAMEA virtual path to the script being executed. This is used
for self-referencing URLs.
SERVER_NAMEThe server’s host name, DNS alias, or IP address as it would
appear in self-referencing URLs.
SERVER_PORTThe port number to which the request was sent.
SERVER_PORT_SECUREA string that contains either 0 or 1. If the request is
being handled on the secure port, then this will be 1. Otherwise, it will be 0.
SERVER_PROTOCOLThe name and revision of the request information protocol. Format:
protocol/revision.
SERVER_SOFTWAREThe name and version of the server software answering the
request (and running the gateway). Format: name/version.
URLGives the base portion of the URL.
HTTP_ACCEPTReturns the value of the Accept header.
HTTP_ACCEPT_LANGUAGEA string describing the language to be used for displaying
content.
HTTP_CONNECTION?
HTTP_HOSTThe name of the Web server. This may or may not be the same
as SERVER_NAME depending on the type of name resolution used on the Web server
(IP address, host header).
HTTP_USER_AGENTA string describing the browser that sent the request.
HTTP_ACCEPT_CHARSET
HTTP_CACHE_CONTROL
HTTP_X_FORWARDED_FORIf the user accesses the Internet via a proxy server, then
this will contain the IP address of the proxy server.

Using Request.ServerVariables

The values of the ServerVariables variables may be obtained by simply assigning
them to a variable. The following example illustrates how to obtain the IP
address of the client computer.

<%
Dim sValue as string
sValue = request.ServerVariables("REMOTE_ADDR")
%>

The full set of names and values may be obtained using the following example:

<%
For Each sValue In Request.ServerVariables
response.write(Request.ServerVariables("sValue"))
Next
%>

Note: information derived from the client headers may not be genuine, for example for years Opera has been able to masquerade as another browser, simply by changing a setting.