Jul 21, 2009 at 2:42 PM


I'm trying out the demo that was provided here:

Whatever I do I can't get this.Master.API.uid to return anything other than 0, this is having accessed it both through facebook and direct.

Any suggestions?


Jul 21, 2009 at 4:16 PM

are your web.config settings correct?

post some code?

Jul 21, 2009 at 4:31 PM

Hi David,

Sorry, I didn't post code as I've just used the template from the link above.

main.aspx.cs is:

partial class main : System.Web.UI.Page
    private facebook.Schema.user visitorInfo = new facebook.Schema.user();

    protected void Page_Load(object sender, EventArgs e)

        visitorInfo = this.Master.API.users.getInfo((long)this.Master.API.uid);

        lblMsg.Text = "Hello " + visitorInfo.first_name + "!";

My master page FBMLMaster.master.cs is:

public partial class FBMLMaster : facebook.web.CanvasFBMLMasterPage
    protected void Page_Load(object sender, EventArgs e)


My web.config is the same as the template, except I've changed the API details.


Jul 22, 2009 at 3:53 PM

Would any further code be helpful to include to help with this?


Jul 22, 2009 at 4:44 PM

The code looks OK, the FDT makes this pretty hands-off, so it's probably a configuration problem.

Try logging OUT of Facebook, then going to your app : use the app URL from the web.config, so it might be something like ""

if everything is wired up right, it will re-direct you to the FB login page.



Jul 23, 2009 at 8:27 AM
Edited Jul 23, 2009 at 1:07 PM

Hi David,

Thanks for your reply.  I think the problem is that the settings in facebook are now different from the tutorials guide on what to put, here's what I have, let me know if I'm doing wrong:

Canvas URL -
Canvas Callback URL -
Tab URL - main.aspx
Render Method - FBML
IFrame Size - Smart size
Canvas Width - Full width (760px)
Quick Transitions - Off
Application Type - Web
Sandbox Mode - Disabled
Session Secret Whitelist Exception - Disabled

The settings mentioned in the tutorial, such as 'Post-Add URL' and 'Side Nav URL' don't seem to be available anymore.
Jul 23, 2009 at 2:54 PM

I think I see the problem. In your master page, you need to set RequireLogin = true before the parent's OnInit event happens. That property tells the master page to go ahead and make sure the user has installed the app, and get a session for that user. The purpose of the property is to allow you to have some pages that don't force the user to install the app, so they can at least see some pages of your app before they decide to authorize/install it.

I'd recommend some code like the following on your master page (assuming you want to set this property on every page):

protected override void OnInit(EventArgs e)
    RequireLogin = true;

Also, I'm not sure that the CanvasCallbackURL is necessarily what you want. I believe that should actually be the root of your site ( so that if you have a relative URL to other parts of your site (eg. href="page2.aspx"), Facebook can construct it by just appending the two. Otherwise, Facebook might try to redirect your users to something like

Hope that helps.