This project is read-only.

Application Lifecycle

Nov 5, 2007 at 9:14 PM
Edited Nov 5, 2007 at 10:52 PM
Thanks so much for this great project.

I need help getting the full lifecycle of a facebook app working. I'm using FB in IFrame mode.

I can't seem to get the IsSessionCreated, InIFrame, and IsAppAdded to work the way I think they should.

In my call back page I added a check to see if user was in the IFrame. That worked fine if the user had already added the app. So I then tried to add IsSessionCreated logic before the IFrame check but that always failed causing a loop. So I know I am doing something wrong.

What is the basic logic for a full FB app that handle users in any state and any way they come to the app. It should have:

- Info page for those who haven't added the app yet with a link to add it
- A redirect if not in IFrame
- A redirect to login if not logged in.
- A just added the app page
- An app removed page

Can someone help me with this?

Thanks

P.S. This is an error I get when my callback page is called by a user who has not added my app. Shouldn't Facebook.NET simply redirect to the Apps Add page like http://www.facebook.com/add.php?api_key=xxxxxx

NullReferenceException: Object reference not set to an instance of an object.
Facebook.Web.FacebookApplication.Render(HtmlTextWriter writer) +106
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +25
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +121
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +22
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +130
System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +24
System.Web.UI.HtmlControls.HtmlForm.RenderChildren(HtmlTextWriter writer) +59
System.Web.UI.HtmlControls.HtmlForm.Render(HtmlTextWriter output) +68
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +25
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +121
System.Web.UI.HtmlControls.HtmlForm.RenderControl(HtmlTextWriter writer) +37
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +130
System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +24
System.Web.UI.Page.Render(HtmlTextWriter writer) +26
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +25
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +121
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +22
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1896
Nov 21, 2007 at 9:57 PM
I'm having the same problem. Got a solution?
Nov 22, 2007 at 5:46 AM
I found a partial solution.

I changed the FacebookApplication property EnableExternalBrowsing to False.

The redirects work now, but the user who has already added the app is directed to the Add Application page.

I've stopped working on my app, so that's all I can say.
Nov 22, 2007 at 8:53 PM
Removing the EnableExternalBrowsing property (or setting it to false) did the trick. Thanks drewmister, not sure I would've guessed to do that.
Dec 3, 2007 at 5:23 AM
Check the latest checkin, 12819 - I fixed a bug where EnableExternalBrowsing would incorrectly not cause a redirect if the user has not added the app.