fb:HyperLinks' NavigationUrl=localhost AFTER Postback

Apr 25, 2008 at 4:50 AM
I am having this problem where all the links in the masterpage as well as links in the standard page point to localhost/ instead of apps.facebook.com/

<fb:FacebookHyperLink ImageUrl="~/App_Common/Images/logo.gif" ID="FacebookHyperLink1" runat="server" NavigateUrl="~/Default.aspx" />
<div id="nav">
<fb:FacebookHyperLink ImageUrl="../Images/myimage.gif" ID="fblkCreate" runat="server" NavigateUrl="~/Integ/Start.aspx" />
<fb:FacebookHyperLink ImageUrl="../Images/myimage1.gif" ID="fblkAction" runat="server" NavigateUrl="~/Integ/Action.aspx" />
</div>

clicking on this has the effect of redirecting me to "you have already added this app..." page...

Interesting in seeing if anyone has already ran up against the same problem...

Again, only after postbacks does the url in fblinks get rewritten. Thanks in advance!


Apr 25, 2008 at 9:40 PM
The FacebookIFrameSession.ResolveUrl method basically just takes the requested page URL and appends it to the base URL derived from the referrer.

If the referrer is blank or null, then the URL would just be "/Integ/Start.aspx" or whatever. To the browser, the base URL for that root relative one is the root URL of the IFRAME. In this case, it's obviously localhost.

If I were you, I'd craft my URLs manually by concatenating a base URL (the apps.facebook.com/yourapp) business with the Integ/Start.aspx. It's only marginally more hassle but you've got 100% control.

Bill