Workshop

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


This workshop will help reinforce the concepts I've covered in today's lesson. It is very helpful to understand fully the answers before moving on. Answers can be found in Appendix A.

Quiz

1:

What is the difference between a file and a stream?

2:

What are the six FileMode values?

3:

What does the Peek method do, and why is it helpful?

4:

How do you verify the existence of a file or directory on a server?

5:

Use the File object to open a file called userdata.txt in the root directory of your c: drive, for appending. If this file doesn't exist, use the File object to create it, and make sure that no other applications can access this file while you are using it.

Exercises

1:

Create an ASP.NET page that will open a file specified by a user in a text box, and display the contents in a label. Make sure to check whether the file exists. Note that the user must be required to enter the full path to the file as well.

2:

Modify Exercise 1 so that the content of the file is displayed in an editable text box. Allow the user to make changes, and when the user clicks a submit button, write the changes back to the file.


    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

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