upload files from the client to the server
You may want to create an interface that allows staff from the Human Re-
sources department to upload company documentation for reference by em-
ployees.
access directories and directory information
You may want to let the Human Resources department choose the drive to
which staff will upload files. For instance, you may have one drive dedicated
to spreadsheets, and another just for Word documents.
Once you have a firm grasp on the intricacies of working with text files and dir-
ectory information, youll learn how to send email in ASP.NET using the Sys-
tem.Net.Mail namespace. Well finish the chapter with a quick introduction to
serialization.
Writing and Reading Text Files
The System.IO namespace contains three different groups of classes:
classes for working with files
classes for working with streams
classes for working with directories
As we progress through this chapter, well look at each of these groups. However,
lets begin by discussing the tasks of writing to and reading from text files with
the aid of the classes that work with files and streams. These classes include:
File
contains methods for working with files
FileStream
represents a stream for reading and writing to files
StreamReader
reads characters from a text file
StreamWriter
writes characters to a text file
572
Chapter 14: Working with Files and Email

Get Build Your Own ASP.NET 2.0 Web Site Using C# & VB, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.