Articles   Dev Forums   Personalize   Favorites   Member Login        Active Users:  222
DevASP - ASP and XML Articles, Samples, Toturials, Sample Chapters and resources for Developers Thursday, July 02, 2009
Home
Articles & Samples
Dev Search
Dev Forum
Add a Listing
Sample Chapters
Directory Feed
Link to US
Contact

Search Directory
Applications
Articles & Samples
Components
Community
Database
Developer Sites
Downloads
Hosting Services
Introduction
Knowledge Base
Sample Chapters
WebCasts

ESET
ASP Directory
Applications
Articles & Samples
Components
Developer Sites
Knowledge Base
Sample Chapters
WebCasts
XML Directory
Applications
Articles & Samples
Developer Sites
Error, Bugs & Fixes
Downloads
Introduction
Knowledge Base
Sample Chapters
WebCasts


ASP Server Variables

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><B>Server Variable Name</B></TD>"
Response.Write "  <TD><B>Server Variable Value</B></TD>"
Response.Write " </TR>"

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

Response.Write "</TABLE>"

%>

Click here to see the List of all available Server Variables

Have Questions? Discuss this topic in Dev Forum

DevASP - Privacy - Disclaimer
Copyright © 2008 DevASP.com