Using Server Variables
Introduction.
In any web interaction there is a large variety of
information that is passed. When a developer
wants to access this information it is usually identified by using the
name Server Variables.
This information or server variables is usually classified into two major categories
This information can be accessed within an ASP by using an appropriate Request.ServerVariables command. The names of the Server Variables are given in the following two tables. |
HTTP Header |
Description |
HTTP_ACCEPT | A list of the MIME types the client will accept |
HTTP_ACCEPT_LANGUAGE | What type of languages the browser expects. These are human languages such as en-us to represent English, United States. |
HTTP_CONNECTION | The type of connection established between the client and the web server. |
HTTP_HOST | The hostname of the web server. |
HTTP_USER_AGENT | The browser type and version, and operating system of the client. |
HTTP_REFERER | The full URL of the web page containing the hyperlink used to reach the currently executing ASP page. |
HTTP_COOKIE | The cookies sent from the browser. |
Environment Variable |
Description |
URL | The URL of the ASP page between http://www.yourWebServer.com/ and any query string. |
PATH_INFO | The same as the URL environment variable. |
PATH_TRANSLATED | The full, physical path of the currently executing ASP. |
APPL_PHYSICAL_PATH | The physical address of the web's root directory. |
QUERY_STRING | The querystring. |
SERVER_NAME | The web server's computer name. |
SERVER_SOFTWARE | The name of the web server software. |
HTTP Headers.
Now we want to develop a small ASP that requests some of the HTTP
headers and displays them. So you want to copy the following code into
a file called SomeHTTPHeaders.asp
and upload it back to your ASP web.
<%@ Language=VBScript %> The meaning of the code will be discussed in class. Now you would get something like the following screen when you view the page. |
Environment Variables.
Now we want to develop a similar ASP for displaying some important
Environment Variables. You should create a file called SomeEnvironmentVariables.asp
and copy in the following code.
<%@ Language=VBScript %> The meaning of the code will be discussed in class. You should get a screen that looks something like the following. |