//
public static bool IsExist(string uri)
{
HttpWebRequest req = null;
HttpWebResponse res = null;
try
{
req = (HttpWebRequest)WebRequest
req
req
res = (HttpWebResponse)req
return (res
}
catch
{
return false;
}
finally
{
if (res != null)
{
res
res = null;
}
if (req != null)
{
req
req = null;
}
}
}
//
private bool UrlExistsUsingXmlHttp(string url)
{
//注意
MSXML
_xmlhttp
_xmlhttp
return (_xmlhttp
}
//
private bool UrlExistsUsingSockets(string url)
{
if (url
try
{
System
return true;
}
catch (System
{
System
return false;
}
}
From:http://tw.wingwit.com/Article/program/net/201311/11555.html