How To Check a Web Page For a String Using .NET C# Using HttpWebRequest

using System.Text;
using System.Net;using System.IO;
HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create(URL);myRequest.Method = "GET";WebResponse myResponse = myRequest.GetResponse();StreamReader sr = new StreamReader(myResponse.GetResponseStream(), System.Text.Encoding.UTF8);string result = sr.ReadToEnd();sr.Close();myResponse.Close();

//Now, once you have this, perform the search on result string
int stringFound = result.IndexOf("My search string");

Ryan Hayes

Ryan is a Microsoft MVP award winner with over eight years of software experience, working with big-name clients such as Discovery Channel, AOL, Toyota, and the National Academy of Sciences. Ryan has helped teams deliver award-winning applications that drive business processes, site traffic, and profit, putting his experience and creativity to work to build amazing solutions for the enterprise web, desktop and mobile platforms.