O'Reilly logo

ASP in a Nutshell, 2nd Edition by A. Keyton Weissinger

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Converting Environment Variables

CGI applications often make use of information residing in environment variables. These variables contain information about the web server itself or about the HTTP request sent by the client browser. In CGI written in Perl, these variables' values are retrieved from the %ENV associative array. In WinCGI written using O'Reilly's CGI framework for Visual Basic programmers, these values are retrieved from the contents of global variables made available by the CGI.BAS or CGI32.BAS code modules.

Active Server Pages applications also make use of these variables. In ASP, this information is retrieved from the Request object's ServerVariables collection. Table 2.2 will help you convert your CGI environment variables to ASP, while Table 2.3 will aid in converting WinCGI to ASP. Note that the general syntax required to retrieve the ASP variable is:

               varname = Request.ServerVariables("ASP_Variable")

Note also that there are other environment-type variables available to ASP applications that are not available to CGI or WinCGI.

Table B.2. Converting CGI Environment Variables to ASP Variables

CGI Environment Variable

ASP Variable

Description

AUTH_TYPE

AUTH_TYPE

Authentication method used to validate user.

CONTENT_LENGTH

CONTENT_LENGTH

Length of the query data (in bytes or number of characters) passed through standard input to the CGI application.

CONTENT_TYPE

CONTENT_TYPE

The media type of the query data (for example "text/html") sent ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required