开发者

Getting started with the facebook c# SDK

开发者 https://www.devze.com 2023-02-05 22:38 出处:网络
This is my second post and I am going slightly mad. I have read all the posts on this forum an spent the best part of every night this week hitting my head against a brick wall. I am an experienced co

This is my second post and I am going slightly mad. I have read all the posts on this forum an spent the best part of every night this week hitting my head against a brick wall. I am an experienced coder but I cannot for the life of me get my "facebook connect" to work.

What I think I want to do is;

I have a c# asp.net solution which is a webforms solution which I develop on visual studio 2010. I want a simple page which gets my information from facebook and shows me my name. The simplest of simple.

How far have I got? I have a facebook app with my "Site Domain" set to englandkorfball.co.uk. I have the "Site URL" set to http://www.englandkorfball.co.uk/test.aspx?app=1

I have downloaded and referenced the 3.5 framework SDK dlls from codeplex.

I have put on test.aspx, the simplest of code which I do no know how to show you here

Q1. Can I show you my code in an easy format? I cannot work out the formatting on the site.

it is from all the web examples involving FB.init, the meta declaration and the fb:login-button. This part works fine. I log out of facebook, click on the button and I get asked to log in. I remove the app and it asks me fine. All 开发者_StackOverflowthis is fine.

It is the server side bit which I cannot for the life of me work out. I have used

Authorizer authorizer = new CanvasAuthorizer(fbApp);
if (authorizer.IsAuthorized())

and

Authorizer authorizer = new Authorizer(fbApp);
if (authorizer.IsAuthorized())

and

if (fbApp.IsAuthenticated) {

but nothing will induce a positive authenticated result.

Have I got the wrong end of the stick. How do I check if I am logged in server side?

Thanks, I have run out of ideas and patience for something which could be so good.


Here is a step by step buide on how you create a Facebook Application with ASP.NET, if you follow this throughly step by step, you will have a working app in no time. You have to be sure that the web.config part is exactly what it should be, here's an explanation of it:

  • appId – Application ID
  • appSecret - Application Secret
  • baseDomain – Site Domain
  • cookieSupport –“false”
  • maxRetries – “2” (or the number of times you want the SDK to retry an action)
  • retryDelay – “1” (or how long do you want it to wait before retrying

Samples from Facebook C# SDK

  • ASP.NET MVC Sample
  • WebForms iFrame Sample
0

精彩评论

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