I want to read the content from the .txt file and display the content at the paragraph tag
on the client side. I absolutely got no idea how can i do that and i do not any function that i use. Please, advice me on this. I looked at this but anything seems to meet my requirements making a paragraph in html contain a text from a fileprotected void Button1_Click(object sender, EventArgs e){
String line;
String filePath = "C:\\Users\\Administrator\\Test.txt";
try
{
//Pass the file path and file name to the StreamReader constructor
StreamReader sr = new StreamReader(filePath);
//Read the first line of text
line = sr.ReadLine();
//Continue to read until you reach end of file
while (line != null)
{
//write the lie to console window
Console.WriteLine(line);
//Read the next line
line = sr.ReadLine();
}
//close the file
sr.Close();
Console.ReadLine();
}
catch (Exception e1)
{
Console.WriteLine("Exception: " + e1.Message);
}
finally
{
Console.WriteLine("Executing finally block.");
}
}