Did you know? DZone has great portals for Python, Cloud, NoSQL, and HTML5!
.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 10 posts at DZone. You can read more from them at their website. View Full User Profile

C# and Facebook

02.08.2012
Email
Views: 2700
  • submit to reddit
The .NET Zone is presented by JNBridge and VaraLogix to keep you updated on all the latest news, tips, and tools in the .NET community.  Check out today's top .NET content and read about JNBridge's innovative tools for .NET and Java interoperability and VaraLogix's deployment automation and CM utilities plus their best practices.

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.)

This content was brought to you in partnership with JNBridge and VaraLogix JNBridge specializes in .NET and Java interoperability while VaraLogix empowers developers and IT operations with an all-in-one deployment and CM product.  Be sure to view JNBridge's brief video series on accessing Java from .NET and see VaraLogix's tips for taking the risk out of .NET deployment.