Invite Friends to Add Application - CanvasIFRAMEBasePage

Feb 26, 2008 at 9:29 PM
Edited Mar 14, 2008 at 4:18 PM
This is my code

in .cs page

using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Collections.ObjectModel;
using Facebook;
using Facebook.WebControls;
using Facebook.Controls;
using Facebook.Components;

public partial class _Default : CanvasIFrameBasePage
{
//Facebook.Components.FacebookService _fbService = new Facebook.Components.FacebookService();
private const string FACEBOOKAPIKEY = "xxxxxxxxxxxxxxxx";
private const string FACEBOOK_SECRET = "xxxxxxxxxxxxxxxxxx";

new protected void Page_Load(object sender, EventArgs e)
{
base.Api = FACEBOOKAPIKEY;
base.Secret = FACEBOOK_SECRET;
base.Page_Load(sender, e);

if (!IsPostBack)
{
string txt = this.FBService.MultiFriendSelector(new Uri("http://apps.facebook.com/XXXX/default.aspx"), "'This application does something to your friends. Join me in the Application!' <fb:req-choice url='http://www.facebook.com/add.php?apikey=89d92671ec5570ec7afdac4554ce6b6e' label='Check out the Application!' />", "Add My Application", "", "request", true);
lnkAdd.NavigateUrl = txt;

}

}


this is on aspx page::


<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title>Index</title>
</head>
<body>
<form id="form1" runat="server" style="height:auto;">

<asp:HyperLink ID="lnkAdd" runat="server" Target="_top"> </asp:HyperLink>
</form>
</body>
</html>

Feb 26, 2008 at 11:10 PM

rocky10 wrote:
string txt = this.FBService.MultiFriendSelector(new Uri("http://apps.facebook.com/XXXX/default.aspx"), "'This application does something to your friends. Join me in the Application!' <fb:req-choice url='http://www.facebook.com/add.php?apikey=89d92671ec5570ec7afdac4554ce6b6e' label='Check out the Application!' />", "Add My Application", "", "request", true);

It looks like you took some pains to obfuscate your application, but you missed the big one: FACEBOOK_SECRET. Exposing it right now may be no big deal, but it could be important if your app gets popular later on. I'd recommend changing it or editing your post right away.

Also, do you have a question or are you just giving away code?

Bill
Mar 1, 2008 at 2:20 AM
Is this code for Facebook.Net? It seems more like Facebook Toolkit code, rather than Facebook.Net code.
Mar 3, 2008 at 11:09 PM

TMC wrote:
Is this code for Facebook.Net? It seems more like Facebook Toolkit code, rather than Facebook.Net code.

Ooo, good catch! I see that now that you mention it.

Bill
Mar 14, 2008 at 4:20 PM
Edited Mar 14, 2008 at 4:20 PM
this is my test appl

It doesnt matter exploring secret key

any way thanks for ur advice