Can't call GetExtendedPermissions in 2.0

Nov 17, 2008 at 4:35 AM
Here's my code:

public partial class _Default : CanvasIFrameBasePage
    private const string FACEBOOK_API_KEY = "xxx";
    private const string FACEBOOK_SECRET = "xxx";

    new protected void Page_Load(object sender, EventArgs e)
        base.ApiKey = FACEBOOK_API_KEY;
        base.Secret = FACEBOOK_SECRET;
        base.Page_Load(sender, e);

    protected void btnStatus_Click(object sender, EventArgs e)
        //this line doesn't look right, but there's no way to derive a reference to FacebookService from anything already known
        facebook.Components.FacebookService fbs = new facebook.Components.FacebookService();

        if( this.API.users.hasAppPermission(facebook.Types.Enums.Extended_Permissions.status_update))

when I run it, I get this exception:

[ThreadStateException: ActiveX control '8856f961-340a-11d0-a96b-00c04fd705a2' cannot be instantiated because the current thread is not in a single-threaded apartment.]
   System.Windows.Forms.WebBrowserBase..ctor(String clsidString) +3653451
   System.Windows.Forms.WebBrowser..ctor() +54
   facebook.Forms.FacebookExtendedPermission.InitializeComponent() +29
   facebook.Forms.FacebookExtendedPermission..ctor(String loginUrl, Extended_Permissions permission, FacebookService service) +41
   facebook.Components.FacebookService.GetExtendedPermission(Extended_Permissions permission) +57
   _Default.btnStatus_Click(Object sender, EventArgs e) in c:\Clients\c2622\\public_html\cyberbully\FMBL\Default.aspx.cs:27
So, apparently, what I'm doing isn't right, but I can't figure out what the right approach would be.

Anybody have a suggestion?

Oct 3, 2010 at 1:28 PM


I have the same problem. I wasted lots of hours finding a solution.

I'm very much thankful if you can give me the correct way to ask for extended permissions,