Home

ASP ADVANCED

This entire chapter is devoted to the Active Server Pages File Access component.  By using this component within your Active Server Pages, you can gain complete control over your computer's file system.  The first section of this chapter presents an overview of the objects used by this component.  In the second Section, you learn how to read and write to a text file.  The third section shows how to work with the methods, Properties, and collections of files.  The final section investigates the methods for manipulating folders and drives.

Overview of the File Access Component

In previous releases of Internet Information Server, you had very restricted access to the file system.  You were limited to doing nothing more than reading and writing from a text file.  This limitation was sorely felt.  For example, no direct method was available for doing something as simple as checking whether or not a file exists.

Fortunately, with the release of Internet Information Server 4.0, this situation has changed dramatically.  The version of Active Server Pages included with this release has a rich set of methods, properties, and collections for Working with files.  By using Active Server Pages scripts, you now have complete control over almost all aspects of the file system.

To work with files, you use the File Access component.  This component uses the following objects:

  • FileSystemObject.  This object includes all the basic methods for working with the file system.  For example, you can use the methods of this object to copy and delete folders and files.

  • Textstream.  This object is used for reading and writing to a file.

  • File.  The methods and properties of this object enable you to work with individual files.

  • Folder.  The methods and properties of this object enable you to work with file folders.

After reading the following pages, you'll understand how to use the most valuable methods and properties of these objects.  For a complete list of the methods, properties, and collections of these objects, see Appendix A, "Quick ASP Object and Component Reference," at the back of this book.