Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

Share this Page URL

Part IV: XML in e-Commerce and Other Adv... > Processing and Displaying Purchases ... - Pg. 279

279 Chapter 22. Processing and Displaying Purchases in an Online Bookstore The previous hour presented code that reads a database of available books and displays a list of purchased books. This code assumes that the data files are in the same directory as the HTML file that's being executed. In the real world of Web commerce, however, computers create and ex- change files in what's known as the client-server model. The XML data files reside on the server side, which means that the code to search them also has to run on the server. In this hour, you'll learn the following: · · · · The basics of the client-server model of data transfer on the World Wide Web How to send data from the client to the server using the Querystring environment variable How to obtain and use the Microsoft Personal Web Server How to work with text files at the level of the server The Client-Server Model of the World Wide Web When you're running a browser with an Internet connection and you enter a URL into the destination text box, you're really not visiting anything. The URL is a request to the Web directory computers for the location of a file. If that location has a valid address, the computer containing the file is contacted with a request for a file. That file is then sent over the Internet to your machine, where it's displayed. In this model, your machine is acting as the client and the computer that sends the file is the server. Note When two computers are communicating, the one that requests information is known as the client, and the one that accepts the request and returns the information is known as the server. If you're running an online bookstore, the data files of the available books and additional information are available on your server. Because these files are large, it makes no sense to send them to the client before they're searched. Therefore, the code to perform the searches is placed on the server and is run when the HTML file executing on the client passes the appropriate message to the server. A Microsoft Active Server Page (ASP) is a file that will dynamically create an HTML file on the server when a message is received from the client. That file is then sent back to the client for display. ASP files have the general form of *.asp. The Querystring Environment Variable When a process is running on the client machine, there's an environment variable known as Querystring that's part of the normal communication between the client and server machines. It contains a character string and can be assigned explicit values in your code.