CanvasFBMLBasePage Problem

Jul 1, 2007 at 4:39 PM
Hi,

Not sure if this is where problems are meant to go, but I figure it will at least get read.

There is a problem with the CanvasFBMLBasePage code, dealing with the case where the application has not been added by the user. The line in question is line #73. The line is checking if 'facebook.com' is in the request URL. Obviously in a FBML canvas page, Facebook is proxying the request on behalf of the user. The request URL is going to be the callback URL on your server, and not the Facebook URL. This causes the test to always fail, and not add the <fb:redirect ...> to the response. Instead the response is redirected back to Facebook's own add page, which it tries to interpret as FBML and fails.

#71 if (!_fbService.IsAppAdded())
#72 {
#73 if (!string.IsNullOrEmpty(Request.Url.ToString()) && Request.Url.ToString().ToLower().Contains("facebook.com"))
#74 {
#75 Response.Write("<fb:redirect url=\"" + FACEBOOKADDURL + _fbService.ApplicationKey + @"&v=1.0" + "\"/>");
#76 Response.End();
#77 }
#78 else
#79 {
#80 Response.Redirect(FACEBOOKADDURL + _fbService.ApplicationKey + @"&v=1.0");
#81 }
#82 }

Quick fix is obviously to remove the contains check for 'facebook.com'. Though I suspect it may have been put there as part of a sanity check, so might need to be swapped (Request.UserHostName maybe?).
Coordinator
Jul 2, 2007 at 2:35 PM
I will test this today. I found that I needed this in the case for a non-logged in user. Because after the login, the request was coming in differently than I expected it and I needed this check. But, I will go through the scenarios and check your case.

Thanks.
Coordinator
Jul 2, 2007 at 10:15 PM
Thanks for the catch. I made some changes in v1.2 that seems to fix the issue. LEt me know if you still have problems.