How to start with new Facebook SDK for ASP.NET
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:
- How to start
- Basic authentication examples
- More examples...
- 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.
精彩评论