skij
asked on
ASP.NET / C# : Look for phrase using remote web request
Using ASP.NET/C#, how can I test if a remote website contains a specified phrase? This does NOT work:
String strResult;
WebResponse objResponse;
WebRequest objRequest = HttpWebRequest.Create("http://www.example.com/");
objResponse = objRequest.GetResponse();
using (StreamReader sr = new StreamReader(objResponse.GetResponseStream()))
{
strResult = sr.ReadToEnd();
Print(strResult);
sr.Close();
}
if( strResult contains "illustrative examples") {
Console.WriteLine("Phrase Found");
}
else {
Console.WriteLine("Phrase Not Found");
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.