home account info subscribe login search My ITKnowledge FAQ/help site map contact us


 
Brief Full
 Advanced
      Search
 Search Tips
To access the contents, click the chapter and section titles.

Platinum Edition Using HTML 4, XML, and Java 1.2
(Publisher: Macmillan Computer Publishing)
Author(s): Eric Ladd
ISBN: 078971759x
Publication Date: 11/01/98

Bookmark It

Search this book:
 
Previous Table of Contents Next


Table 33.4 The Server Variables

Variable Name Description

AUTH_TYPE specifies the server’s authentication method
AUTH_PASSWORD specifies the password the user entered within the client browser
CONTENT_LENGTH returns the content’s length
CONTENT_TYPE returns the content’s data type
GATEWAY_INTERFACE returns the version of the server’s CGI specification
HTTP_<HeaderName> returns information contained within <HeaderName>
LOGON_USER specifies the NT login account that made the request
PATH_INFO specifies the server’s path information
PATH_TRANSLATED returns a translated version of PATH_INFO
QUERY_STRING returns the query string contained within the URL
REMOTE_ADDR specifies the client machine’s IP address
REMOTE_HOST specifies the requesting host’s name
REQUEST_METHOD returns the method initiating the request
SCRIPT_NAME specifies the executing script’s virtual path
SERVER_NAME returns the server’s host name, DNS alias, or IP address
SERVER_PORT returns the server’s port number on which the request is made
SERVER_PORT_SECURE returns a 1 if the request is made on the server’s secure port, 0 if unsecured
SERVER_PROTOCOL returns the requesting protocol’s name and version
SERVER_SOFTWARE returns the HTTP server’s name and version
URL returns the URL’s base portion


NOTE:  If you’ve done any CGI programming, you’ll recognize the variables in Table 33.4 as the CGI environment variables.

In addition, the Request object includes the following property and method:

  TotalBytes—The TotalBytes property tells you the total number of bytes the client sends. The syntax for using the TotalBytes property is
Request.TotalBytes

where Request is the Active Server Request object and TotalBytes represents the total number of bytes the client sends.
  BinaryRead—By using the BinaryRead method, the Web server can read binary information the client sends through the POST request. The BinaryRead method’s syntax is
aBinaryArray=Request.BinaryRead(count)

where Request is the Active Server Request object, aBinaryArray is the binary array the BinaryRead method will create, and count is the total number of bytes for aBinaryArray.

Using Existing ASP Components

In addition to the Application, Session, Server, Response, and Request objects, IIS comes with a number of predefined, pretested Active Server components you can readily use within your ASP application. You will find these existing server-side components extremely useful in building your ASP application:

  Active Data Object (ADO)—The ADO is probably one of the most important ASP components. By using the ADO, you can communicate with back-end databases and create dynamic, data-driven Web sites.
  Browser Capabilities—By using the Browser Capabilities component, you can detect the type of client browser, determine the browser’s capabilities through an INI file, and display appropriate HTML.
  Advertisement Rotator—The Advertisement Rotator component displays ad banners within your Web site. In addition, you can change the ad banners dynamically.
  Permission Checker Component—By using the Permission Checker component, you can determine whether a user has access permission to a given file.
  Content Linking Component—The Content Linking component helps you to design and develop a navigation scheme for your Web site.
  Page Counter Component—The Page Counter component tracks the number of times a page from your Web site has been requested. As a result, you can determine the amount of interest your Web site generates.

This chapter discusses the first two components: the Active Data Object and Browser Capabilities.

Active Data Object (ADO)

ADO is based on OLE DB, a C++ based applications programming interface (API). OLE DB is Microsoft’s new database technology based on object linking and embedding. Because the technology is based on C++, its API is object oriented. ADO includes data providers and data consumers. The data providers access the OLE DB interface, and the data consumers take data from the interface. ADO is similar to Microsoft’s Data Access Object (DAO) and Remote Data Object (RDO). However, Microsoft designed ADO specifically with Internet-based applications in mind.

ADO enables you to add database connectivity to your ASP application. To create an instance of the ADO component, you use the Server object’s CreateObject method. The following line of code shows an example of creating a database connection:

Set myDBConnection=Server.CreateObject(““ADODB.Recordset””)

Next, you can use the ADO object’s Open method to store the results of executing a given SQL statement. The following line of code shows an example of executing the given SQL statement and storing the results within the result set:

myDBConnection.Open “SELECT * FROM Transactions”


Previous Table of Contents Next


Products |  Contact Us |  About Us |  Privacy  |  Ad Info  |  Home

Use of this site is subject to certain Terms & Conditions, Copyright © 1996-2000 EarthWeb Inc.
All rights reserved. Reproduction whole or in part in any form or medium without express written permission of EarthWeb is prohibited. Read EarthWeb's privacy statement.