Saturday, 31 May 2014

Read a file in Asp.net Using StreamReader

System.IO.StreamReader sr = new System.IO.StreamReader("/1.txt");
string line;
while (sr.Peek() != -1)
{
line = sr.ReadLine();
Response.Write(Server.HtmlEncode(line) + "
");
}