facebook c# sdk integration from codeplex

1.2k views Asked by At

I am using c# sdk facebook integration from codeplex and getting a strange error:

I have the following in my web.config and get an error that it does not recognize

Compile Error:

Warning 12 C:\Documents and Settings\admin\Desktop\car\Phase_2\tissot\tissot4\Default.aspx: ASP.NET runtime error: Unrecognized configuration section facebook. (C:\Documents and Settings\admin\Desktop\car\Phase_2\tissot\tissot4\web.config line 17) C:\Documents and Settings\admin\Desktop\car\Phase_2\tissot\tissot4\Default.aspx 1 1 tissot4

<facebookSettings
appSecret="################"
appId="$$$$$$$$$$$$$$$$$" 
/>

<canvasSettings
canvasPageUrl=http://apps.facebook.com/myapp/
authorizeCancelUrl=http://apps.facebook.com/myapp/ 
/>
2

There are 2 answers

1
codingbadger On

According to the documentation here the canvasSettings element should contain the following:

  • canvasPage
  • authorizeCancelUrl

You have canvasPageUrl where as you should be using canvasPage

From the article mentioned above:

Now, right below that tag you should see the “canvasSettings” settings element. Change it as follows (again use the Facebook screen to help you):

  • canvasPage – Canvas Page
  • authorizeCancelUrl – “http://www.facebook.com “(or any URL you want it to go to when Authorization fails)
0
codeandcloud On

Have you defined the configSections?

Since Configuration Section Tags not defined is a Microsoft Bug which can be resolved by adding the configuration section tag after the section like this

<configSections>
    <section name="facebookSettings" type="Facebook.FacebookConfigurationSection"/>
    <section name="canvasSettings" type="Facebook.Web.CanvasConfigurationSettings"/>
  </configSections>

  <facebookSettings
        appSecret="your_api_secret" 
        appId="your_app_id" />
  <canvasSettings
    canvasPageUrl="http://apps.facebook.com/graphtoolkit/"
    authorizeCancelUrl="http://apps.facebook.com/graphtoolkit/home/cancel" />