Thursday, September 24, 2015

Read a Text File in C# and ASP.Net

string root = Server.MapPath("~");
string Template = root +"\\filetext.txt";
StringBuilder line = new StringBuilder();
using (StreamReader rwOpenTemplate = new StreamReader(Template))
{
while (!rwOpenTemplate.EndOfStream)
{
line.Append(rwOpenTemplate.ReadToEnd());
}
}