HTTP Server Variables

Overview

Each HTTP transaction that takes place between a client browser and a server involves the exchange of a great deal of potentially useful information. This sample demonstrates one way you can access this information, by accessing server variables. Using server variables, you can, determine the server's name with the SERVER_NAME variable, or the HTTP headers with the ALL_HTTP variable.

Code Tour

The sample's structure is simple: form a two-column table, and fill each table row with a name, value variable pair. Each individual server variable is retrieved by using the name as a key, such as Request.ServerVariables("ALL_HTTP"). In addition, because ServerVariables is a collection, you can use a For Each ... Next loop to iterate through all variables found in the collection.

Location

The VBScript and JScript versions of this script are available in the IIS samples directory, at ...\asp\interaction\ServerVariables_VBScript.asp and ...\asp\interaction\ServerVariables_JScript.asp.