Summary

IOTA^_^    

Sams Teach Yourself ASP.NET in 21 Days, Second Edition
By Chris Payne
Table of Contents
Day 13.  Reading and Writing Files on the Web Server


Today you learned all about how ASP.NET handles file access. ASP.NET allows you to include other files in your pages, to extend functionality using other files in your pages, and to read and write files to the server.

Use the server-side include syntax to include other files in your ASP.NET page:

 <!--#include file="filename"--> 'or <!--#include virtual="filename"--> 

This is often useful in places that don't require user controls.

Files are physical objects on the hard drive, consisting of binary data. Streams are objects that allow access to these files, and other types of data stores, such as memory locations and network computers. The System.IO namespace provides all the objects described here.

The File and Directory objects provide access to file and directory attributes, as well as the ability to manipulate them; that is, copy them, delete them, move them, and so on. The Attributes collection of each object enumerates the attributes such as archived, hidden, or indexed properties.

FileShare, FileAccess, and FileMode specify the privileges used to open files, such as read-write access, whether to create a new file or open an old one, and how other applications can access the files once opened.

The StreamReader and StreamWriter objects allow you to write Unicode characters to streams by converting them into binary data. The Read, ReadLine, ReadToEnd, and Peek methods allow you to read through the contents of a stream, whereas the Write and WriteLine methods allow you to create output to streams.

Isolated storage provides a mechanism to store data in files that are particular for a user, assembly, or domain, without having to determine unique pathnames. This allows for highly customized user data storage, similar to cookies. The IsolatedStorageFile object represents a virtual storage location for the particular user, and the IsolatedStorageFileStream object represents files within the storage location. The latter object can be used with StreamReader or StreamWriter objects to read and write data to the files.

Tomorrow you're going to take a look at a concept often used with database and file I/O design: caching. ASP.NET provides a robust caching mechanism that is very interesting to play with. See you tomorrow!


    IOTA^_^    
    Top


    Sams Teach Yourself ASP. NET in 21 Days
    Sams Teach Yourself ASP.NET in 21 Days (2nd Edition)
    ISBN: 0672324458
    EAN: 2147483647
    Year: 2003
    Pages: 307
    Authors: Chris Payne

    Similar book on Amazon

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net