CanvasFBMLBasePage Problem

Jul 1, 2007 at 3:39 PM

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 '' 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(""))
#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 ''. Though I suspect it may have been put there as part of a sanity check, so might need to be swapped (Request.UserHostName maybe?).
Jul 2, 2007 at 1: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.

Jul 2, 2007 at 9: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.