简体   繁体   中英

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>

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM