Getting started help! Master.Api calls

Oct 26, 2010 at 4:40 PM

Hi, I'm a total beginner and I'm having a lot of trouble getting started. I've created my app, and can successfuly view my app on Facebook. I also have the authorization set up.


However, I can't figure out how to use the API! From all the tutorials i've looked at, you are supposed to do "Master.Api.****" but the Master.Api does not exist in my Visual Studio project. What do i do to set this up? Could someone post a thorough tutorial, or maybe just the sample code from the master and a webpage file that makes this work?


Thanks a lot, I'm having a lot of trouble finding good documentation.

Oct 26, 2010 at 9:18 PM

Download the last source code. 

You have a IFrame application sample with masterpage.

Oct 26, 2010 at 10:33 PM

Thanks, but the sample does not work for my either. When trying a Master.Api call, i get "Are you missing a directive or assembly reference?" error.

Oct 27, 2010 at 4:24 AM

If you are starting a new app you may want to check out the new Facebook C# SDK at or at

Oct 27, 2010 at 8:29 AM

If you are in a page with a single master page (which is not a child of an other masterpage), try

var Master = (Facebook.Web.CanvasIFrameMasterPage)this.Page.Master;

then you'll can use Master.Api

I use (with 2 masterpages)

 var Api = ((Facebook.Web.CanvasIFrameMasterPage)this.Page.Master.Master).Api;

then, Api.GetInfo...

Oct 28, 2010 at 1:50 AM

thanks a lot! i only have one masterpage.


when i try this, it seems to work, but upon opening the website i get this error:


System.InvalidCastException: Unable to cast object of type 'ASP.masterpage_master' to type 'Facebook.Web.CanvasIFrameMasterPage'.

Nov 4, 2010 at 9:00 PM

can someone please help? i can't even get the sample iFrame application provided to work...