D
Diana L
Hi:
I'm trying to get this isolated storage snippet to work. It's trying to
write a few lines, then trying to read them and print them out to the
browser.
The browser prints the "Writing..." lines, and the "End of job" line, but no
"Reading" lines.
I've tried to debug it a bit, and the reader.Peek() value is -1 prior to the
first reader.ReadLine() attempt.
Anyone have any ideas? I'm on VS 2003 & .Net 1.1
Here's the code:
private void Page_Load(object sender, System.EventArgs e)
{
IsolatedStorageFileStream stream = new IsolatedStorageFileStream
("colors.txt",FileMode.Create,FileAccess.ReadWrite);
StreamWriter writer = new StreamWriter(stream);
string[] data = { "red", "orange", "yellow", "green", "blue", "indigo" };
for (int i=0; i<data.Length; i++)
{
writer.WriteLine(data);
Response.Write("Writing: " + data + "<br>");
}
stream.Seek(0,SeekOrigin.Begin);
StreamReader reader = new StreamReader(stream);
while (reader.Peek() > -1)
{
Response.Write("Reading: " + reader.ReadLine() + "<br/>");
}
reader.Close();
Response.Write("Normal eoj.");
}
I'm trying to get this isolated storage snippet to work. It's trying to
write a few lines, then trying to read them and print them out to the
browser.
The browser prints the "Writing..." lines, and the "End of job" line, but no
"Reading" lines.
I've tried to debug it a bit, and the reader.Peek() value is -1 prior to the
first reader.ReadLine() attempt.
Anyone have any ideas? I'm on VS 2003 & .Net 1.1
Here's the code:
private void Page_Load(object sender, System.EventArgs e)
{
IsolatedStorageFileStream stream = new IsolatedStorageFileStream
("colors.txt",FileMode.Create,FileAccess.ReadWrite);
StreamWriter writer = new StreamWriter(stream);
string[] data = { "red", "orange", "yellow", "green", "blue", "indigo" };
for (int i=0; i<data.Length; i++)
{
writer.WriteLine(data);
Response.Write("Writing: " + data + "<br>");
}
stream.Seek(0,SeekOrigin.Begin);
StreamReader reader = new StreamReader(stream);
while (reader.Peek() > -1)
{
Response.Write("Reading: " + reader.ReadLine() + "<br/>");
}
reader.Close();
Response.Write("Normal eoj.");
}