Articles  
DevASP.NET for ASP.NET, VB.NET, XML and C# (C-Sharp) Developers Tuesday, March 03, 2009
Search Directory
ASP Directory
Xml Directory

FREE 12 month online training for ASP.NET & MS Expression Studio and a Free copy of MS Expression Web with Windows Server Purchase
ASP Server Variables

Author: Asif

This simple example will show you some commonly used server variables and a small script that can be used to retrieve the list of server variables and their values.

  • HTTP_REFERER
    Request.ServerVariables("HTTP_REFERER")
    Give you the URL of the referring page.
  • HTTP_USER_AGENT
    Request.ServerVariables("HTTP_USER_AGENT")
    Returns the information of the browser requesting the page.
  • QUERY_STRING
    Request.ServerVariables("QUERY_STRING")
    Returns the Query information from the URL after the question mark (?).
  • REMOTE_ADDR
    Request.ServerVariables("REMOTE_ADDR")
    Returns the The IP address of the remote host who has requested the page.
<%

Dim VariableName

Response.Write "<TABLE Border=1 BorderColor=""BBBBBB"">"
Response.Write " <TR>"
Response.Write "  <TD>Server Variable Name</TD>"
Response.Write "  <TD>Server Variable Value</TD>"
Response.Write " </TR>"

For Each VariableName In Request.ServerVariables
 
 Response.Write "<TR>"
 Response.Write " <TD> " & VariableName & "</TD>"
 Response.Write " <TD> "
 Response.write   Request.ServerVariables(VariableName)
 Response.Write " </TD>"
 Response.Write "</TR>"
 
Next

Response.Write "</TABLE>"

%>
Disclaimer - Privacy
© 2002-2014 DevASP.com