Newbie help!

Sep 25, 2007 at 10:00 AM
Edited Sep 25, 2007 at 4:52 PM
Session not getting propertly initialized (fbApplication.IsSessionCreated == false). though I am logged in to Facebook. I am debugging through localhost. Here are the steps I have done so far.

1. Created the app in Facebook 'Glenn Test'. Set the urls to http://localhost:50000/SampleApp/IFrame. Set to use IFrame
2. Updated the app name (in both config and default.aspx), apikey and secret.
3. Set the web app to not use dynamic ports (50000)
4. Set the web app to wait for the first request.
5. Run the app in debug mode.
6. Login to facebook and then go to apps.facebook.com/glenntest

If I put a break point and then go the app (apps.facebook.com/glenntest) then I do get the request via the iframe. If I step through the code, the session is not getting properly created in FaceBookApplication.

Any help is greatly appreciated.
Coordinator
Sep 26, 2007 at 5:43 AM
Since you have breakpoints added, what is happening when you step through the code instead of properly creating the session object?
Sep 26, 2007 at 7:01 AM
AArgh, I just hit the wrong button and lost 20 minutes of typing (it went back to the previous page)

Shortened version...

1. Request and Form dictionaries have no values. As a result code steps through FaceBookApplication.OnInit, OnPageInitComplete() and all the base methods and FaceBookApplication.isAppAdded, FaceBookApplication.inCanvasPage, FaceBookApplication._inIFramePage, IFrameSession.sessionKey, IFrameSession.userID, IFrameSession.sessionExpries are null

2. FaceBookApplication.redirectUrl is set to "http://www.facebook.com/login.php?api_key=3e8b386f2db45f20393bb46e5213fd44&v=1.0"
Config for the app "GlennTest" was retrieved and Api Key and Secret are initialized propertly.

Thanks
Coordinator
Sep 27, 2007 at 4:50 AM
Unless I am completely missing something... if Facebook isn't passing any information in the request, i.e. if the Form collection is truly empty as you say it is, then I don't think the Framework can do anything but redirect you... do you see anything else the framework could do?

Now the question is why is the Form collection empty - something is causing Facebook to not send any information, which is unexpected. Are you sure the app has been registered correctly - all the canvas/callback URLs etc? I know Facebook's app registration isn't the most straightforward thing.
Nov 14, 2007 at 1:29 AM
Hi NikhilK,

Your sample application always returns fbApplication.IsSessionCreated == false, even after I am logged in Facebook!
What do I do wrong?

private void Page_Load() {
if (fbApplication.IsSessionCreated == false) {
return;
}

User user = fbApplication.Service.Users.GetUser(null, "name");
if (user != null) {
greetingLabel.Text = "Hello " + user.Name;
}
}