<%@ Import Namespace=System.IO >
string line = Alice,F,35;
string[ ] fields = line.Split(',');
for(int i = 0; i <= 2; i++)
{
Response.Write(fields[i]);
}
Test line 1. Test line 2. Test line 3.Then run this code
public void Page_Load(object source, EventArgs e)
{
StreamReader sr = new StreamReader(c:/it130/test.txt)
string line1 = sr.ReadLine( );
Response.Write(Line1: + line1 + value of Peek: +
sr.Peek( ) +
);
string line1 = sr.ReadLine( );
Response.Write(Line2: + line1 + value of Peek: +
sr.Peek( ) +
);
string line1 = sr.ReadLine( );
Response.Write(Line3: + line1 + value of Peek: +
sr.Peek( ) +
);
}
The output should repeat line1, line2 and line3, give nonnegative return values
of Peek for lines 1 and 2, and return -1 for line3.
Alice,35 Bob,41 Casey,23 Doug,28 Gail,43 Stephanie,34 Zoe,19Load the date into two arrays, which are then added to the Session collection. Display the date in a Literal when a button with caption Display Data is clicked.