开发者

How to start with new Facebook SDK for ASP.NET

开发者 https://www.devze.com 2023-01-22 19:07 出处:网络
I\'ve done quite some research on which ASP .NET Facebook SDK to use. Acording to this post (http://msdn.microsoft.com/en-us/windows/ee388574.aspx) old FacebookToolkit should not be used for new proje

I've done quite some research on which ASP .NET Facebook SDK to use. Acording to this post (http://msdn.microsoft.com/en-us/windows/ee388574.aspx) old FacebookToolkit should not be used for new projects but instead we should use the all new and shiny Facebook C# SDK.

But he problem is that it lacks documentation, especially开发者_运维问答 beginners examples for creating Facebook applications with Facebook SDK and WebForms:

  1. How to start
  2. Basic authentication examples
  3. More examples...
  4. Where did Facebook.Web.CanvasIFrameMasterPage go from Toolkit ? :)


If you want to use webforms then you should really just revise the Facebook Authentication protocol. You are going to be using the Javascript SDK to do authentication, then just making your server side calls with the SDK, of which there are examples, usually something along the lines of:

var app = new FacebookApp();
// Get the user info from the Graph API
dynamic me = app.Api("/me");
var firstName = me.first_name;

If you want to use webforms with the SDK you are going to have to do some of the legwork yourself. If you continue to struggle with Authentication I can come up with an example for you.

In fact you can even do:

var app = new FacebookApp();
var authorizer = new CanvasAuthorizer(app);
authorizer.Perms = "stream_publish";
authorizer.Authorize(this.Request, this.Response);

Which redirects the user if they are not properly authenticated or don't have the correct permissions.

0

精彩评论

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

关注公众号