如何检查Facebook个人资料网址是否存在于Facebook或不存在于aspnet mvc 4 c#

时间:2015-10-15 06:34:54

标签: c# asp.net-mvc facebook facebook-graph-api

我使用过此代码,但如果facebook url无效,则会返回200 status code

我验证了4个社交媒体网址twitterfacebooklinkedinxing

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;

0 个答案:

没有答案