.NET Zone is brought to you in partnership with:

Amir Ahani (Microsoft Most Valuable Professional) is expert in Microsoft .NET technologies such as C# and he spends most of his time teaching and consulting internationally. He has been teaching advanced Microsoft courses at British Columbia Institute of Technology (BCIT) since 2003. In addition, he is a member of and speaker at the following communities: DevTeach, .netBC, Vancouver Technology Festival, ASQ, APICS, PMI, NPA, and ITAC. Amir is a DZone MVB and is not an employee of DZone and has posted 12 posts at DZone. You can read more from them at their website. View Full User Profile

C# and Facebook

02.08.2012
| 5105 views |
  • submit to reddit

You can interact with Facebook in C# by installing Facebook C# SDK dlls. The easiest way to do this is using NuGet. To add the reference, right click on “References”, and then click “Add Library Package Reference…”. From the Add Library Package Reference dialog do a search for “Facebook”. After the install completes click “Close”.

NuGet will do a few things automatically for us there. First, references for Facebook and Newtonsoft.Json will be added to the project. Second, some settings will be added to the web.config file. You also need to set our application so that it runs on the same port every time. So lets set the app to run on port 8080.

To give more scale to your Facebook app, you need to publish your app to Windows Azure. You can use the following links for this purpose:

http://blog.smarx.com/posts/asp-net-mvc-in-windows-azure

http://drew-prog.blogspot.com/2011/01/how-to-publish-aspnet-mvc-3-app-to.html

Lastly, you can use the following links for leveraging Facebook with C# and with Windows Azure:

Windows Azure SDK and Windows Azure Tools for Microsoft Visual Studio Prerequisite

http://www.microsoft.com/downloads/en/details.aspx?FamilyID=7a1089b6-4050-4307-86c4-9dadaa5ed018

Facebook C# SDK Prerequisite

http://facebooksdk.codeplex.com/

Building a Facebook Marketing App on Azure

http://www.devx.com/MS_Azure/Article/46308#fbid=r1C49LxPtVl

Facebook Connect

http://msdn.microsoft.com/en-us/windows/ee702803#

Facebook Platform

http://msdn.microsoft.com/en-us/windows/cc895481#

Writing your first Facebook application

http://blog.prabir.me/post/Facebook-CSharp-SDK-Writing-your-first-Facebook-Application.aspx#

References
Published at DZone with permission of Amir Ahani, author and DZone MVB. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)