<%@ Page Language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">

    protected void Page_Load(object sender, EventArgs e)
    {

        // Opens a file and returns a FileStream
        System.IO.FileStream fs = 
            System.IO.File.Open(@"C:\Wrox\temp.txt", System.IO.FileMode.Open);


        // Opens a file and returns a StreamReader for reading the data
//        System.IO.StreamReader sr = System.IO.File.OpenText(@"C:\Wrox\temp.txt");


        // Opens a filestream for reading
//        System.IO.FileStream fs = System.IO.File.OpenRead(@"C:\Wrox\temp.txt");


        // Opens a filestream for writing 
//        System.IO.FileStream fs = System.IO.File.OpenWrite(@"C:\Wrox\temp.txt");


        // Reads the entire file and returns a string of data
        string data = System.IO.File.ReadAllText(@"C:\Wrox\temp.txt");


        // Writes the string of data to the file 
        System.IO.File.WriteAllText(@"C:\Wrox\temp.txt", data);
    }
</script>