I know how to read a line in a txt file, but for some reason C # does not detect the end of the line in HTML files. This code basically opens the html file and tries to parse line by line in search of the specified line. Even when just trying to print the first line of text in an HTML file, it is not displayed.
using (StreamReader sr = new StreamReader("\\\\server\\myFile.html"))
{
String line;
while ((line = sr.ReadLine()) != null)
{
if(line == ("<td><strong>String I wantstrong></td>"))
{
Label1.Text = "Text Found";
break;
}
}
}
I tried this using a simple text file and it works great, just not when trying to parse an HTML file.
Thank.
source
share