简体   繁体   中英

facebook c# sdk integration from codeplex

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/ 
/>

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" />

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)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM