2012/10/08

WebClient.DownloadString()

I just want to check a web content has something I want or not, so I use the WebClient.DownloadString() instead of using HttpWebRequest, HttpWebResponse, StreamReader... etc.
using (WebClient wclient = new WebClient())
{
    wclient.Encoding = Encoding.UTF8;   // change to fit your environment
    string content = wclient.DownloadString(url);
    result = content.Contains(keyword);
}