我使用过此代码,但如果facebook url无效,则会返回200 status code
我验证了4个社交媒体网址twitter
,facebook
,linkedin
,xing
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
req.AllowAutoRedirect = false;
HttpWebResponse res = (HttpWebResponse)req.GetResponse();
if (res.StatusCode == HttpStatusCode.OK || res.StatusCode == HttpStatusCode.Found)
return true;
else
return false;