
This tutorial gives you insight in to Server Variables in ASP, what they are, and how they can be used.
Server Variables, as the name suggests, are variables that are held on your web sites server. They hold important information about the web site, the current sessions client, and other various information such as the current pages address and paramters etc.
To get access to the Server Variables in ASP, you use the ServerVariables() command of the request object:
request.ServerVariables("VarName")
The ServerVariables collection is read-only. You can use a variable from the list below in place of 'VarName'
Below is a list of Server Variables that can be accessed, and what they represent.
| Name | Description |
|---|---|
| AUTH_PASSWORD | Returns the clear text password used to authenticate the user. This value is only valid for clear text authenication schemes. |
| AUTH_TYPE | Returns the name of the scheme used to authenticate the user. |
| AUTH_USER | Returns the raw authenticated user name. |
| HTTP_REFERER | Returns a string containing the URL of the original request when a redirect has occurred. |
| HTTP_<HeaderName> | Returns the value of the HTTP request header (HeaderName). Note that the server will convert any underscore characters in the header name to dashes before searching for the value in the request header. |
| LOCAL_ADDR | Returns the IP address of the server as a string |
| LOGON_USER | Returns the name of the currently logged on user. |
| NET_STAT | Returns true if the network is currently available. |
| QUERY_STRING | Query information stored in the string following the question mark (?) in the HTTP request. |
| REMOTE_ADDR | Returns the IP address of the client as a string. |
| REQUEST_METHOD | Returns the HTTP request method. |
| REQUEST_PATH | Returns path from the HTTP request. |
| REQUEST_URL | The URL for the client request |
| SCRIPT_NAME | The virtual path of the current script page. |
| PACKAGE_NAME | The name of the current package. |
| SERVER_NAME | The DNS name or IP address of the server based on the current request. |
| SERVER_PORT | The TCP port the request was received on. |
| SERVER_SOFTWARE | The name and version of the current server software. |