please dont rip this site


The ServerVariables collection retrieves the values of environment variables.


Request.ServerVariables (variable)

See or



Specifies the name of the server environment variable to retrieve. It can be one of the following values.




The authentication method that the server uses to validate users when they attempt to access a protected script.


The length of the content as given by the client.


The data type of the content. Used with queries that have attached information, such as the HTTP queries POST and PUT.


The revision of the CGI specification used by the server. Format: CGI/revision


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.


The Windows NT® account that the user is logged into.


Extra 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.


A translated version of PATH_INFO that takes the path and performs any necessary virtual-to-physical mapping.


Query information stored in the string following the question mark (?) in the HTTP request.


The IP address of the remote host making the request.


The name of the host making the request. If the server does not have this information, it will set REMOTE_ADDR and leave this empty.


The method used to make the request. For HTTP, this is GET, HEAD, POST, and so on.


Gives the base portion of the URL.


A virtual path to the script being executed. This is used for self-referencing URLs.


The server's host name, DNS alias, or IP address as it would appear in self-referencing URLs.


The port number to which the request was sent.


A 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.


The name and revision of the request information protocol. Format: protocol/revision


The name and version of the server software answering the request (and running the gateway). Format: name/version


Gives the base portion of the URL.


If a client sends a header other than those specified in the preceding table, you can retrieve the value of that header by prefixing the header name with “HTTP_” in the call to Request.ServerVariables. For example, if the client sent the following header:


You could retrieve SomeNewValue by using the following syntax:

 <% Request.ServerVariables("HTTP_SomeNewHeader") %>

You can use an iterator to loop through each server variable name. For example, the following script prints out all of the server variables in a table.

<TR><TD><B>Server Variable</B></TD><TD><B>Value</B></TD></TR>
<% For Each name In Request.ServerVariables %>
<TR><TD> <%= name %> </TD><TD> <%= Request.ServerVariables(name) %> </TD></TR>
<% Next %>


The following example uses the Request object to display several server variables.

<!-- This example displays the content of several ServerVariables. -->
ALL_HTTP server variable =
<%= Request.ServerVariables("ALL_HTTP") %> <BR>
CONTENT_LENGTH server variable =
<%= Request.ServerVariables("CONTENT_LENGTH") %> <BR>
CONTENT_TYPE server variable =
<%= Request.ServerVariables("CONTENT_TYPE") %> <BR>
QUERY_STRING server variable =
<%= Request.ServerVariables("QUERY_STRING") %> <BR>
SERVER_SOFTWARE server variable =
<%= Request.ServerVariables("SERVER_SOFTWARE") %> <BR>

The next example uses the ServerVariables collection to insert the name of the server into a hyperlink.

<A HREF = "http://<%= Request.ServerVariables("SERVER_NAME") %>
/scripts/MyPage.asp">Link to MyPage.asp</A>

Applies To

Request Object

See Also

ClientCertificate, Cookies, Form, QueryString

© Microsoft Corporation. All rights reserved.

file: /Techref/language/asp/obj/introbj_11.htm, 9KB, , updated: 2001/3/2 15:37, local time: 2024/5/27 15:45,

 ©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?
Please DO link to this page! Digg it! / MAKE!

<A HREF=""> ServerVariables</A>

After you find an appropriate page, you are invited to your to this massmind site! (posts will be visible only to you before review) Just type a nice message (short messages are blocked as spam) in the box and press the Post button. (HTML welcomed, but not the <A tag: Instead, use the link box to link to another page. A tutorial is available Members can login to post directly, become page editors, and be credited for their posts.

Link? Put it here: 
if you want a response, please enter your email address: 
Attn spammers: All posts are reviewed before being made visible to anyone other than the poster.
Did you find what you needed?

  PICList 2024 contributors:
o List host: MIT, Site host, Top posters @none found
- Page Editors: James Newton, David Cary, and YOU!
* Roman Black of Black Robotics donates from sales of Linistep stepper controller kits.
* Ashley Roll of Digital Nemesis donates from sales of RCL-1 RS232 to TTL converters.
* Monthly Subscribers: Gregg Rew. on-going support is MOST appreciated!
* Contributors: Richard Seriani, Sr.

Welcome to!