Creating a FacebookApplication control in codebehind

Aug 28, 2008 at 12:51 PM
Hey! I've ran into a dead end with Facebook.NET a bit. I'm trying to dynamically create the FacebookApplication control in codebehind.

The code looks something like:

protected void Page_Load(object sender, EventArgs e) {
Facebook.Web.FacebookApplication fb = new Facebook.Web.FacebookApplication();
fb.ApplicationKey = "my key";
fb.Secret = "my secret";
fb.Mode = Facebook.Web.FacebookApplicationMode.IFrame;
fb.EnableExternalBrowsing = true;
fb.ApplicationName = "helloWorldIFrameApp";

I'm getting an error thrown, since it seems the session key and the service object is null. Is there a 'gotcha' I've overlook or :D?

Aug 28, 2008 at 2:22 PM
Can you get everything you need by just creating a new FacebookService() object ???

You'll need to have stored the user's session key at some point previous to do this though.

Sep 23, 2008 at 4:11 AM
Creating a user control-less FacebookApplication is not currently supported. There's an issue in the tracker somewhere about it. However, you can make some service calls using the FacebookService object.