Click here to Skip to main content
15,902,032 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
i wanna get facebook person details by use of there email id in my asp.net page...
Posted
Updated 23-Jul-13 20:33pm
v4

1 solution

Facebook released the Facebook C# SDK alpha in 2010.
You can find the details in Developers this site.

Please find the code for connecting facebook and C#.

C#
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class facebook_login : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        string host = Request.ServerVariables["HTTP_HOST"];
        string facebookClientId = 
          System.Configuration.ConfigurationManager.AppSettings["FacebookClientId"];
        string RedirectURL = "";
        if (Request.QueryString["redirectURL"] != null)
        {
            RedirectURL = Request.QueryString["redirectURL"].ToString();
            Session["RedirectURL"] = RedirectURL;
        }
        Response.Redirect(@"https://graph.facebook.com/oauth/authorize?client_id=" + 
          facebookClientId + "&redirect_uri=http://" + host + 
          @"/FBcallback.aspx&scope=publish_stream,offline_access,publish_actions");
    }
}


You can find the detailed explanation about this in a CodeProject Article.
Please find the LINK
 
Share this answer
 
Comments
Rohit Jaswal 24-Jul-13 2:40am    
Thanks for ans.
i'm facing following error:
The remote server returned an error: (400) Bad Request.

this function throw error:
public string WebResponseGet(HttpWebRequest webRequest)
{
StreamReader responseReader = null;
string responseData = "";

try
{
responseReader = new StreamReader(webRequest.GetResponse().GetResponseStream());
responseData = responseReader.ReadToEnd();
}
catch
{
throw;
}
finally
{
webRequest.GetResponse().GetResponseStream().Close();
responseReader.Close();
responseReader = null;
}

return responseData;
}


can you help me to solve the error?
Sarin VT 24-Jul-13 2:58am    
have look at the link i gave.
The code i pasted here is not complete.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900