SetFBML Problem

Jun 3, 2008 at 6:32 PM
Hi

I am having trouble setting the fbml for my facebook application, here is the MARKUP page:
-------------------------------------------------------------------------------------------------------

<%

@ Page Language="C#" MasterPageFile="Site.master" AutoEventWireup="true" CodeFile="Default.aspx.cs" Debug="true"

 

 

Inherits="_Default" Title="Untitled" %>

 

<

 

asp:Content ID="Content1" ContentPlaceHolderID="CenterColumnContentPlaceHolder"

 

 

runat="Server">

 

 

<asp:UpdatePanel ID="UpdatePanel1" runat="server">

 

 

<ContentTemplate>

 

 

<div id="contentheader">

 

 

<div class="floatleft"><asp:Image ID="Image1" Width="50px" Height="50px" runat="server" /></div>

 

 

<h2>

 

 

<asp:Literal ID="Label1" runat="server" Text="Label"></asp:Literal>

 

 

</h2>

 

 

 

<asp:MultiView ID="mvXML" runat="server">

 

 

<asp:View ID="vXMLTrue" runat="server">

 

 

 

<script type="text/javascript">

 

 

AC_FL_RunContent = 0;

 

 

</script>

 

 

 

<script src="../Scripts/AC_RunActiveContent.js" type="text/javascript"></script>

 

 

 

<script type="text/javascript">

 

 

if (AC_FL_RunContent == 0) {

 

alert(

"This page requires AC_RunActiveContent.js.");

 

}

else {

 

AC_FL_RunContent(

'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0'

 

,

'width','380'

 

,

'height','375'

 

,

'id','imageSlideshow'

 

,

'align','middle'

 

,

'src','/player'

 

,

'quality','high'

 

,

'bgcolor','#ffffff'

 

,

'name','imageSlideshow'

 

,

'allowscriptaccess','sameDomain'

 

,

'allowfullscreen','false'

 

,

'pluginspage','http://www.macromedia.com/go/getflashplayer'

 

,

'movie','/player',

 

 

 

'flashvars', 'xmlurl=<asp:Literal ID="xmlURL" runat="server"></asp:Literal>'

 

 

);

//end AC code

 

 

 

//alert("falash exe");

 

}

 

</script>

 

 

 

<noscript>

 

 

<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="380" height="375" id="Object1" align="middle">

 

 

<param name="allowScriptAccess" value="sameDomain" />

 

 

<param name="allowFullScreen" value="false" />

 

 

<param name="movie" value="/player.swf" />

 

 

<param name="quality" value="high" />

 

 

<param name="bgcolor" value="#ffffff" />

 

 

<param name="flashvars" value="" />

 

 

<embed src="/player.swf" quality="high" bgcolor="#ffffff" width="380" height="375" name="imageSlideshow" align="middle" allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />

 

 

</object>

 

 

</noscript>

 

 

 

</asp:View>

 

 

<asp:View ID="vXMLFalse" runat="server">

 

INVALID

 

</asp:View>

 

 

</asp:MultiView>

 

 

 

 

</div>

 

 

<div style="clear:both"></div>

 

 

</ContentTemplate>

 

 

</asp:UpdatePanel>

 

</

 

asp:Content>

 

<

 

asp:Content ID="Content5" runat="server" ContentPlaceHolderID="FooterContentPlaceHolder">

 

<

 

div class="brand">

 

</

 

div>

 

</

 

asp:Content>

------------------------------------------------------------------------------------------
AND HER IS THE CODE BEHIND:
------------------------------------------------------------------------------------------

 

using

 

System;

 

 

 

using

 

System.Data;

 

 

 

using

 

System.Configuration;

 

 

 

using

 

System.Collections;

 

 

 

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

 

Facebook;

 

 

 

using

 

System.Data.SqlClient;

 

 

 

using

 

System.Web.Mail;

 

 

 

using

 

System.IO;

 

 

 

using

 

System.Text;

 

 

 

using

 

System.Text.RegularExpressions;

 

 

 

using

 

System.Xml;

 

 

 

using

 

System.Drawing.Drawing2D;

 

 

 

public

 

partial class _Default : System.Web.UI.Page

 

 

 

 

{

Facebook.Components.

FacebookService _fbService = new Facebook.Components.FacebookService();

 

 

private const string FACEBOOK_APPKEY = "0bbb898f2632db1eed76929806fb9b34"; // From the Facebook application page

 

 

 

 

 

private const string FACEBOOK_SECRET = "839741824e2d1b74988cd6389ca146af"; // From the Facebook application page

 

 

 

 

 

string userId;

 

 

protected void Page_Load(object sender, EventArgs e)

 

{

_fbService.ApplicationKey = FACEBOOK_APPKEY;

_fbService.Secret = FACEBOOK_SECRET;

_fbService.IsDesktopApplication =

false;

 

 

 

string sessionKey = Session["facebook_session_key"] as String;

 

userId = Session[

"facebook_userId"] as String;

 

 

// When the user uses the facebook login page,

 

 

 

 

 

// the redirect back here will have the auth_token in the query params

 

 

 

 

 

string authToken = Request.QueryString["auth_token"];

 

 

 

if (!String.IsNullOrEmpty(sessionKey))

 

{

_fbService.SessionKey = sessionKey;

_fbService.UserId = userId;

}

 

else if (!String.IsNullOrEmpty(authToken))

 

{

_fbService.CreateSession(authToken);

Session[

"facebook_session_key"] = _fbService.SessionKey;

 

Session[

"facebook_userId"] = _fbService.UserId;

 

Session[

"facebook_session_expires"] = _fbService.SessionExpires;

 

}

 

else

 

 

 

 

{

Response.Redirect(

@"http://www.facebook.com/login.php?api_key=" +

 

_fbService.ApplicationKey +

@"&v=1.0");

 

}

 

if (!IsPostBack)

 

{

System.Collections.ObjectModel.

Collection<User> userinfo = _fbService.GetUserInfo(_fbService.UserId);

 

Label1.Text =

"Hi, " + userinfo[0].FirstName;

 

Image1.ImageUrl = userinfo[0].PictureUrl.ToString();

 

 

// Use the FacebookService Component to populate Friends

 

 

 

 

 

//NOT NEEDED

 

 

 

 

 

//System.Collections.ObjectModel.Collection<User> Friends = _fbService.GetFriends();

 

 

 

 

 

//for (int i = 0; i < Friends.Count; i++)

 

 

 

 

 

// DropDownList2.Items.Add(Friends[i].FirstName.ToString());

 

 

 

 

 

}

 

//string xmlCookie = Request.Cookies["xml"].Value.ToString();

 

 

 

 

 

//Response.Write(xmlCookie);

 

 

 

 

 

//if cookie is there then set FMBL with swf for player

 

 

 

 

 

if (!string.IsNullOrEmpty(Request.Cookies["xml"].Value.ToString()))

 

{

 

//decode cookie

 

 

 

 

xmlCookie = Server.UrlDecode(Request.Cookies[

"xml"].Value.ToString());

 

 

//Response.Write("xmlCookie: " + xmlCookie);

 

 

 

 

 

//check if xml is valid by seeing if it is in the db

 

 

 

 

validXML(xmlCookie);

}

 

else

 

 

 

 

{

mvXML.ActiveViewIndex = 1;

}

}

 

void validXML(string xmlCookie)

 

{

//database stuff

connection.Open();

dtruser = command.ExecuteReader();

 

if (dtruser.Read())

 

{

 

//if all is good

 

 

 

 

xmlURL.Text =

"../publishedXML/" + "M3259854O3379327S.xml"; // xmlCookie;

 

 

 

 

 

//Response.Write(xmlURL.Text);

 

 

 

 

 

//Response.Write("carl" + _fbService.SetFBML());

 

 

 

 

Response.Write(

"fbml:" + profile.getFBML());

 

_fbService.SetFBML(

"<fb:swf" + "swfbgcolor='000000'" + "swfsrc='http://www.martiantest.com/player.swf'"

 

 

 

 

+

"imgsrc='~/images/narrow.jpg'" + "width='180'" + "height='432'" + "flashvars=" + xmlCookie + "/>" + "carlito rulez!");

 

 

Facebook.

mvXML.ActiveViewIndex = 0;

}

 

else

 

 

 

 

{

mvXML.ActiveViewIndex = 1;

}

connection.Close();

 

}

}

--------------------------------------------------------------------------------
I would appreciate if anyone could help.

Thanks