简体   繁体   中英

How to get the profile photo of facebook user who is registered my site with facebook registration application(not using mvc)

I am developing a web page default.aspx.(Not an mvc application) with a facebook registration plugin.I need to get the profile picture of user who is logging into my application using their facebook id.I saw fql examples but i dont know how to implement it in c# code behind page. I was able to get the profile information in code behind.Please help me how to get the profile picture from user who is registering my page .i am using c# 2008

If you are getting the FacebookID just generate the image URL

 <img src="https://graph.facebook.com/FacebookIDOrUserName/picture"/>

http://developers.facebook.com/docs/reference/api/

If you need to download the image:

Image image = null;
string URL = "https://graph.facebook.com/FacebookIDOrUserName/picture";

HttpWebRequest req = (System.Net.HttpWebRequest)HttpWebRequest.Create(URL);
req.AllowWriteStreamBuffering = true;
req.Timeout = 20000;

WebResponse resp = req.GetResponse();
System.IO.Stream stream = resp.GetResponseStream();

image = Image.FromStream(stream);

resp.Close();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM