Tutorial Navigation
 

     
 Links
 

 
.

 

 Search         Date   
      

ASP
:  Server Variables using ASP, 
February 17, 2004  -  by Pemtium  

Server Variable
USAGE:
  Request.ServerVariables (variable)

Example: Request.ServerVariables("REMOTE_ADDR")
Return the IP Address.

The must common Server variable used:
Variable Description
ALL_HTTP Returns all HTTP headers sent by the client.
ALL_RAW Returns all headers information in raw form
APPL_MD_PATH Returns the meta base path for the application.
APPL_PHYSICAL_PATH Returns the physical path corresponding to the meta base path
CERT_SERIALNUMBER Returns the serial number field of the client certificate
CONTENT_LENGTH Returns the length of the content as sent by the client
CONTENT_TYPE Returns the data type of the content
HTTP_<HeaderName> Returns the value stored in the header HeaderName
HTTP_ACCEPT_LANGUAGE Returns a string describing the language to use for displaying content
HTTP_COOKIE Returns the cookie string included with the request
HTTP_REFERER Returns the original URL when a redirect has occurred
HTTP_USER_AGENT Returns a string describing the browser that sent the request
INSTANCE_ID The ID for the IIS instance in text format
LOCAL_ADDR Returns the server address on which the request came in
LOGON_USER Returns the Windows account that the user is logged into
PATH_INFO Returns extra path information as given by the client
REMOTE_ADDR Returns the IP address of the remote host making the request
REMOTE_HOST Returns the name of the host making the request
REMOTE_USER Returns an unmapped user-name string sent in by the user
SERVER_NAME Returns the server's host name, DNS alias, or IP address as it would appear in self-referencing URLs
SERVER_PORT Returns the port number to which the request was sent
SERVER_PORT_SECURE Returns a string that contains 0 or 1. If the request is being handled on the secure port, it will be 1. Otherwise, it will be 0
URL Returns the base portion of the URL

Consult The Microsoft Documentation For A Full Description Of All The Server Variables Below.

Small Sample:
Program: RequestVar.ASP
<b>You are browsing this tutorial using:</b><br>
<%Response.Write(Request.ServerVariables("http_user_agent"))%>
</p>
<p>
<b>Your IP address is:</b><br>
<%Response.Write(Request.ServerVariables("remote_addr"))%>
</p>
<p>
The Result:










   

.

     
 Featured Links