If you do not have a copy already email chris.williams@readwatchcreate.com to get instructions on how to access.
Installation
The first step is setting up your database.- Open the database scripts in the QuickStart zip that start with CREATE_TABLE_. Ensure they table names match your application prefixes for consistency.
- Open the database scripts in the QuickStart zip that start with CREATE_PROC_. Ensure the table names match the tables in the CREATE_TABLE_ scripts in step 1.
- Rename the procs to match your application prefixes for consistency.
- Add the appSetting entries from the web.config in the Quickstart in the Web.Config file for your project. Make sure you change the stored procedure names in the appSettings to match your stored procedure names.
The second step is configure your ASP.NET application to use the plug-in.
- Add standard button or link button to page and implement click event.
- Call the LoginToFacebook function on this class with a call similar to the following but replace {my_site_name} with your site url.
You may also want to change the access you desire:
ASPNET.Authentication.Facebook.FacebookLogin.LoginToFacebook(ConfigurationManager.AppSettings["FacebookAppId"], "http://{my_site_name}/fb.aspx", "offline_access, email, user_likes, friends_likes"); - Create a page called fb.aspx and on load add the following code:
if (Request["code"] != null) Session["AccessToken"] = FacebookLogin.GetAccessToken(ConfigurationManager.AppSettings["FacebookAppId"], ConfigurationManager.AppSettings["FacebookAppSecret"], Request["code"], ConfigurationManager.AppSettings["FacebookReturnUrl"]); - Next you need to add the configuration keys to the web.config in teh appSettings section. These are provided by Facebook when you register your application:
<add key="FacebookReturnUrl" value="http://{my site}/fb.aspx"/>
<add key="FacebookAppId" value="{Likely a 15 digit number}"/>
<add key="FacebookAppSecret" value="{This is a guid with no dashes}"/> - Use the code returned to get the profile info back in JSON then use the helper functions to get each attribute you wish:
string userProfileJSON = CXFacebook.GetUserProfile(Session["AccessToken"].ToString());
/// string id = CXFacebook.GetUserProfileId(userProfileJSON);
/// string name = CXFacebook.GetUserProfileName(userProfileJSON);
/// string firstName = CXFacebook.GetUserProfileFirstName(userProfileJSON);
/// string lastName = CXFacebook.GetUserProfileLastName(userProfileJSON);
/// string email = CXFacebook.GetUserProfileEmail(userProfileJSON);
/// string birthday = CXFacebook.GetUserProfileBirthday(userProfileJSON);
/// string link = CXFacebook.GetUserProfileLink(userProfileJSON);
/// string locale = CXFacebook.GetUserProfileLocale(userProfileJSON);
/// string quote = CXFacebook.GetUserProfileQuotes(userProfileJSON);
/// string userName = CXFacebook.GetUserProfileUserName(userProfileJSON);
/// string timeZone = CXFacebook.GetUserProfileTimezone(userProfileJSON);