if (Request.QueryString["code"] != null)
{
if (Request.QueryString["error"] == "access_denied")
{
ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('User has denied access.')", true);
return;
}
string code = Request.QueryString["code"];
if (!string.IsNullOrEmpty(code))
{
string data = FaceBookConnect.Fetch(code, "me");
FaceBookUser faceBookUser = new JavaScriptSerializer().Deserialize<FaceBookUser>(data);
faceBookUser.PictureUrl = string.Format("https://graph.facebook.com/{0}/picture", faceBookUser.Id);
//pnlFaceBookUser.Visible = true;
//lblId.Text = faceBookUser.Id;
Labelwelcome.Text = faceBookUser.Name;
//lblName.Text = faceBookUser.Name;
//lblEmail.Text = faceBookUser.Email;
ProfileImage.ImageUrl = faceBookUser.PictureUrl;
Labelwelcome.Visible = true;
linksignout.Visible = true;
Linksignin.Visible = false;
ProfileImage.Visible = true;
lblw.Visible = true;
//Response.Cookies["name"].Value = id;
}
}
and after this info show in wel come penal in my web site
and also want to show list of friends
string code = Request.QueryString["code"];
if (!string.IsNullOrEmpty(code))
{
int i = 0;
string data = FaceBookConnect.Fetch(code, "/me/friends");
FaceBookData1 facebookData = new JavaScriptSerializer().Deserialize<FaceBookData1>(data);
foreach (FaceBookUser1 user in facebookData.Data)
{
user.PictureUrl = string.Format("https://graph.facebook.com/{0}/picture", user.Id);
}
gvFriends.DataSource = facebookData.Data.GetRange(0, 15);
gvFriends.DataBind();
}