|
|
|
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
Table 33.4 The Server Variables
|
|
Variable Name
| Description
|
|
AUTH_TYPE
| specifies the servers authentication method
|
AUTH_PASSWORD
| specifies the password the user entered within the client browser
|
CONTENT_LENGTH
| returns the contents length
|
CONTENT_TYPE
| returns the contents data type
|
GATEWAY_INTERFACE
| returns the version of the servers CGI specification
|
HTTP_<HeaderName>
| returns information contained within <HeaderName>
|
LOGON_USER
| specifies the NT login account that made the request
|
PATH_INFO
| specifies the servers 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 machines IP address
|
REMOTE_HOST
| specifies the requesting hosts name
|
REQUEST_METHOD
| returns the method initiating the request
|
SCRIPT_NAME
| specifies the executing scripts virtual path
|
SERVER_NAME
| returns the servers host name, DNS alias, or IP address
|
SERVER_PORT
| returns the servers port number on which the request is made
|
SERVER_PORT_SECURE
| returns a 1 if the request is made on the servers secure port, 0 if unsecured
|
SERVER_PROTOCOL
| returns the requesting protocols name and version
|
SERVER_SOFTWARE
| returns the HTTP servers name and version
|
URL
| returns the URLs base portion
|
|
NOTE: If youve done any CGI programming, youll recognize the variables in Table 33.4 as the CGI environment variables.
In addition, the Request object includes the following property and method:
- TotalBytesThe 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.
- BinaryReadBy using the BinaryRead method, the Web server can read binary information the client sends through the POST request. The BinaryRead methods 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 CapabilitiesBy using the Browser Capabilities component, you can detect the type of client browser, determine the browsers capabilities through an INI file, and display appropriate HTML.
- Advertisement RotatorThe Advertisement Rotator component displays ad banners within your Web site. In addition, you can change the ad banners dynamically.
- Permission Checker ComponentBy using the Permission Checker component, you can determine whether a user has access permission to a given file.
- Content Linking ComponentThe Content Linking component helps you to design and develop a navigation scheme for your Web site.
- Page Counter ComponentThe 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 Microsofts 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 Microsofts 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 objects 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 objects 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
|