Getting Remote Files With ASP - The Concept
(Page 2 of 5 )
Before we begin coding, I’d like to explain what we are going to be doing. There are two ASP applications we will be creating. The first one we’ll refer to as the client, though it technically will still be an application running on a Web server. The second we’ll refer to as the server, which is basically the master application, which will serve updates to the clients.
The client and server may be on the same domain, but in a real life deployment would probably be on completely separate servers and domains. If you do not have the ability to create multiple domains, you can put both on the same domain and put the client script in one folder and the server script in another. Or you can create two different Web servers on the same machine with the technique described here: http://www.aspfree.com/c/a/IIS/Creating-Test-and-Production-Sites-
With-Only-One-IIS-Server/.
Client Script The client script initiates the communication for our auto-update demonstration. From this script, in our example, we will send the server a fake license key as an identifier. The server will then send back the files for the newest version, and any messages (errors, actions, and so on). The files will then be saved to the client's system, and any messages will be parsed and acted upon.
Server Script The server script will send the client a mixed format stream. The stream will consist of text files, text messages, and Base64 encoded binary files. Okay, technically it’s not mixed format, but we are intermixing binary files with text files and text messages –- all within the same XML tree.
Because we are transferring binary files there is often a security risk involved on the server side. And, with an auto-update schema, we would often like to authenticate the client with a license key to make sure that the software has actually been paid for and properly activated. Our server script will not actually perform any authentication, but in a real life situation, the server would do a database lookup to find the license key, check to see whether it is active, and return files associated with the version we are updating to.
The server may also return messages to the client. Examples of these messages may be: disabling or re-enabling the auto-update, letting the client know the software has not yet been paid for, turning settings on or off, and more.
Next: The Code Client Script Initialization >>
More ASP Articles
More By Justin Cook