ASP.net Facebook Canvas FBML Page_Load not being Fired and Button Click not working

Jan 27, 2011 at 6:26 AM

Hi Gurus,

I hav created a versy simple Facebook Canvas FBML App using FDT 3.0.1. I am pasting my code below which help me in explaining my problem:

using System;

using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using Facebook;
using Facebook.Web;
using Facebook.Session;
using Facebook.Rest;

namespace XVZ
{
 public partial class Question : CanvasFBMLBasePage
 {

  protected void Page_PreInit(object sender, EventArgs e)
  {
   base.RequireLogin = true;
  }

  protected void Page_Load(object sender, EventArgs e)
  {
   if (Api.Users.GetInfo().uid > 0)
   {

    Api.Stream.Publish("Current Time Is : " + DateTime.Now.ToString(), null, null, null, Convert.ToInt64(Api.Users.GetInfo().uid.ToString()));
   }

  }

  protected void btnMessage_Click(object sender, EventArgs e)
  {

   //ScriptManager.RegisterStartupScript(this, this.GetType(), "ShowMessage", "ShowMessage();", true);
   Api.Stream.Publish("Current Time Is : " + DateTime.Now.ToString(), null, null, null, Convert.ToInt64(Api.Users.GetInfo().uid.ToString()));
  }

 }

}

 

Now the problem is that First time when i access my application in Facebook using Canvas URL the Page_PreInit and the Page_Load works fine and the status is updated. at the same time my FBML Canvas Page is displayed Properly with a button on it (Thats all i have on the page at the moment). the problem arises when i try to click the button in that case my Page_PreInit,  the Page_Load and the Button Click Event HAndler are not fired (Debuged my application on my live srever) at all and Facebook gives me the following error :

Received HTTP error code 500 while loading http://[my live ip]/myappname/Question.aspx?auth_token=xxxxxxxxxxxxxxxxxxxxxxxxxxxxx 

Sorry, the application you were using is experiencing a problem. Please try again later

 

Please tell me why it does not fire all three events on Button Click. in futur if this gets soleved then i would like to use the button click event for Publishing feeds/stories to the walls of the users who will use my app. I started developing this minor app five days back and i am facing this issue since day one.

Many thanks in advance and i am waiting for a prompt help from you guys. Please take me out of this

regards,

Haroon