Facebook C# SDK ASP.Net 3.5 Examples

I’ve been asked to develop a facebook application that allows users of their current system to find each other using a this facebook app. Unfortuantely their requirements are that it has to be build in ASP.NET 3.5 (Easier for their clients distribution purposes).

I am a experienced PHP developer although I have in the past used C# for windows applications. I have found a facebook api that looks suitable – http://facebooksdk.codeplex.com/. The problem I am having is that all availble examples use .NET 4.

I must admit I’m struggling to get to grips with the api and I know from the past I learn best through example. Could anyone provide a link to examples or some basic code I experiment with?

I would really appreciate any advice or input you have on the situation.
Thanks, Jason.

Update

Using the answer below and the following resource (http://osnapz.wordpress.com/2010/04/23/using-asp-net-with-facebooks-graph-api-and-oauth-2-0-authentication/) it is easy enough to make start on facebook application.

One issue I also had was the server (1&1) I was using needed proxy setting added to the web.config

Example:

<system.net>
   <defaultProxy>
       <proxy
          usesystemdefault = "false"
          bypassonlocal="false"
          proxyaddress="http://ntproxyus.lxa.perfora.net:3128"
       />
   </defaultProxy>
</system.net>

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

Until you become more familiar with ASP.NET, I would suggest integrating with the FacebookClient() rather than the more involved

the one thing you will have to understand is the difference between dynamic and using IDictionary. For C# 4.0 and up you can use dynamic, but for 3.5 you must use the old IDictionary.

Here’s a good example of how to convert from dynamic to IDictionary (so you can use the 4.0 examples as a guide)

var fb = new FacebookClient("{access_token}");

dynamic result = fb.Get("/me");
var name = result.name;

Response.Write("Hi " + name);

Converts to:

var fb = new FacebookClient("{access_token}");

var result = (IDictionary<string, object>)fb.Get("/me");
var name = (string)result["name"];

Response.Write("Hi " + name);

I hope that gets you on your way as far as converting the examples.


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x