Oct 29, 2009 at 8:26 PM
Edited Oct 30, 2009 at 11:44 AM
In Kevin Marshall's MVC sample:
He created a helper called Fbml.TabItem that renders a <fb:tab-item> tag. However, the href for this tag doesn't seem to be generated correctly. It generates a URL that is relative to the application, but apparently the <fb:tab-item>
tag requires the href to start with http://apps.facebook.com/yourapppath/. This is easy enough to change, but this alone doesn't quite solve the problem if the application is running in a virtual directory because UrlHelper.Action returns the virtual
directory as part of the path. Facebook strips the http://apps.facebook.com/yourapppath/ from the URL and replaces it with the Canvas Page URL set in the app settings. This means the virtual directory ends up in the path twice.
An example might make this easier to understand. Assume I have a Facebook app with the following Canvas Page URL:
And the following Canvas Callback URL:
If I set the href of the fb:tab-item tag like this:
href = "http://apps.facebook.com/myapp" + new UrlHelper(vc.RequestContext).Action(actionName, controllerName);
The href gets set to:
Facebook removes the Canvas Page URL (http://apps.facebook.com/myapp) and adds the Canvas Callback URL so we end up with:
And it then tries to retrieve the FBML from this URL. Virtualdirectory is duplicated, leading to a 404.
Anyone know an elegant way to solve this?