facebook application using iframe on Facebook Developer Toolkit 3.0
Posted
by adveb
on Stack Overflow
See other posts from Stack Overflow
or by adveb
Published on 2010-03-30T13:53:18Z
Indexed on
2010/03/30
14:03 UTC
Read the original article
Hit count: 1297
hey
i am trying to build facebook iframe application using the Facebook Developer Toolkit 3.01 asp.net c#.
i am working by the ifrmae sample of the toolkit can be download here. www.facebooktoolkit.codeplex.com/releases/view/39727
this is my facebook application that is the same as the iframe sample. http://apps.facebook.com/alefbet/
this is my code, it has 2 pages, master page and default. this 2 pages are the same as the iframe sample.
1) this is the master page.
public partial class IFrameMaster : Facebook.Web.CanvasIFrameMasterPage { public IFrameMaster() { RequireLogin = true; } }
2) this is the default.aspx
public partial class Default : System.Web.UI.Page { private const string SCRIPT_BLOCK_NAME = "dynamicScript"; protected void Page_Load(object sender, EventArgs e) { if (IsPostBack) { if (Master.Api.Users.HasAppPermission(Enums.ExtendedPermissions.email)) { SendThankYouEmail(); } Response.Redirect("ThankYou.aspx"); } else { if (Master.Api.Users.HasAppPermission(Enums.ExtendedPermissions.email)) { emailPermissionPanel.Visible = false; } CreateScript(); } } private void SendThankYouEmail() { var subject = "Thank you for telling us your favorite color"; var body = "Thank you for telling us what your favorite color is. We hope you have enjoyed using this application. Encourage your friends to tell us their favorite color as well!"; this.Master.Api.Notifications.SendEmail(this.Master.Api.Session.UserId.ToString(), subject, body, string.Empty); } private void CreateScript() { var saveColorScript = @" function saveColor(color) { document.getElementById('" + colorInput.ClientID + @"').value = color; } function submitForm() { document.getElementById('" + form.ClientID + @"').submit(); } "; if (!ClientScript.IsClientScriptBlockRegistered(SCRIPT_BLOCK_NAME)) { ClientScript.RegisterClientScriptBlock(this.GetType(), SCRIPT_BLOCK_NAME, saveColorScript); } } }
my directory structure is
1)the master page is in the root.
2)the default.aspx is in the root/alfbet directory.
3)i have also have the xd_receiver.htm inside root/channel directory.
that inside the master page their is the folowing line:
<script type="text/javascript">
FB_RequireFeatures(["XFBML"], function() {
FB.Facebook.init("c81f17ee4d4ffc5113c55f8b99fdcab5", "channel/xd_receiver.htm");
});
</script>
the problem is that the applicatin dosent work
apps.facebook.com/alefbet/default.aspx
why it dosent work ? please help me and others who also obstacle in this issue.
i tryied lots of things, one of them was to display the user id. for that i put label in the default.aspx and wrote
lblTest.Text = Master.Api.Users.GetInfo().uid.ToString();
and it dosent event get to this line. i know it because it keeps display in the label.text the word "label"
thank you very much.
© Stack Overflow or respective owner