开发者

does facebooksdk 5.0.3 work with mvc2 and dot net 3.5 framework?

Due to certain constraints, such as using Windows Azure, I am limited to using MVC2 and version 3.5 of the dot net framework. I'm wondering if the 5.0.3 version of the SDK will work with this combination?

I ask because all the samples have the 5.0.3 version of Facebook.Web.Mvc linked to MVC version 3.0.

Furthermore, all the examples are linked to dot net 4.0. This includes the Azure sample, eventhough Azure webapps are limited to version 3.5.

Am I limited to an older version开发者_JAVA百科 of the SDK?


To answer part of the question, it works with .NET 3.5 but you might have to resort to reflection techniques to make some kinds of things happen, messy and not recommended by myself. For this same reason I upgraded to .NET 4.0 and installed the 4.0 runtime on our hosting server because C# SDK is more palattable to use with the C# 4.0 dynamic keyword

No personal experience with MVC2 but I've have found that often SDKs work well because the standard ASP.NET features are available (i.e. access to cookies, sessions, authentication, authorization, etc) no matter what kind of web project you're developing in.

The C# SDK MVC Sample has an out-of-date warning about the documentation itself which leads me to believe the framework works because all that is needed is updated samples.

Give it a try by making an instance of the FacebookApp class to see if it doesn't throw any errors and if you can retrieve any info about the user.

This sample grabbed from their Samples section - try it in context of MVC2.

    [CanvasAuthorize(Perms = "user_about_me")]
    public ActionResult Index()
    {
        FacebookApp fbApp = new FacebookApp();
        if (fbApp.Session != null)
        {
            dynamic result = fbApp.Get("me");

            ViewData["Firstname"] = result.first_name;
            ViewData["Lastname"] = result.last_name;
        }

        return View();
    }
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜