是否可以覆盖 Facebook C# SDK 中的 CookieSupport 配置?

发布于 2024-10-11 18:38:27 字数 800 浏览 9 评论 0原文

我有一个 ASP.NET MVC 3 应用程序,其中使用 Facebook C# SDK 进行了一些 Facebook 集成,并启用了 cookie 支持。

我曾计划(并且仍然愿意)创建一个画布 Facebook 应用程序作为主应用程序的一个区域。问题是画布应用程序要求关闭 cookie 支持。是否有办法覆盖该区域中的此设置,或者我被困住了?

2011 年 11 月 1 日更新 我在 web.config 中使用了 location 节点来覆盖 cookieSupport 设置。

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

它似乎可以毫无问题地对已授权该应用程序的用户进行身份验证。但是,尚未获得授权的用户不会获得身份验证(他们看不到权限对话框)。

我应该强调,当“facebook”区域的结构放入它自己的应用程序中时,配置会按预期工作。

富有的

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

£冰雨忧蓝° 2024-10-18 18:38:27

即使您无法通过特定于区域的 web.config 文件来完成此操作,您也可以随时跳过 web.config 中的设置并手动设置它们:

    FacebookSettings facebookSettings = new FacebookSettings
    {
        AppId = yourAppId,
        AppSecret = yourSecret,
        BaseDomain = yourDomain,
        CookieSupport = false,
        MaxRetries = 2,
        RetryDelay = 500
    };
    var app = new FacebookApp(facebookSettings);

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);
埖埖迣鎅 2024-10-18 18:38:27

事实证明,这是 ASP.NET MVC3 RC2 和 Facebook C# SDK 4.1.1 之间的一个问题。有关详细信息,请参阅 http://facebooksdk.codeplex.com/workitem/5794

该问题已在 SDK 4.2.1 版本中得到解决。

富有的

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文