Question

I have an ASP.NET MVC 3 application with some Facebook integration using the Facebook C# SDK with cookie support switched on.

I had planned (and would still like) to create a canvas Facebook application as an Area of the main application. The problem is that canvas applications require that cookie support be turned off. Is there anyway to override this setting in the Area, or am I stuck?

Update 11/01/2011 I used the location node in web.config in order to override the cookieSupport setting.

 <location path="facebook">
  <facebookSettings
   appSecret="***"
   appId="***"
   cookieSupport="false" />

  <canvasSettings
   canvasPageUrl="http://apps.facebook.com/***/"
   canvasUrl="http://www.***.co.uk/facebook/"
   authorizeCancelUrl="http://apps.facebook.com/***/home/cancel" />
 </location>

It appears to authenticate users who have already authorised the app without issue. However users who're have not yet authorised do not get authenticated (they don't see the permission dialog).

I should stress that the configuration works as expected when the structure of the Area 'facebook' is put into an app of it's own.

Rich

Was it helpful?

Solution 2

This turned out to be an issue somewhere between ASP.NET MVC3 RC2 and the Facebook C# SDK 4.1.1. See http://facebooksdk.codeplex.com/workitem/5794 for details.

The issue has since been resolved in version 4.2.1 of the SDK.

Rich

OTHER TIPS

Even if you can't do it via an area-specific web.config file, you could always just skip the settings in the web.config and set them manually:

    FacebookSettings facebookSettings = new FacebookSettings
    {
        AppId = yourAppId,
        AppSecret = yourSecret,
        BaseDomain = yourDomain,
        CookieSupport = false,
        MaxRetries = 2,
        RetryDelay = 500
    };
    var app = new FacebookApp(facebookSettings);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top