参考网站:http://www.cnblogs.com/junny/archive/2012/10/30/2745978.html
public bool CheckUrlVisit(string url)
{
try
{
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
HttpWebResponse resp = (HttpWebResponse)req.GetResponse();
if (resp.StatusCode == HttpStatusCode.OK)
{
resp.Close();
return true;
}
}
catch (WebException webex)
{
return false;
} return false; }