views:

54

answers:

1

Hi Guys,

I have a Facebook Connect application (IFrame, external website).

When i post to the user's wall using the Old JavaScript API (FB.Connect.streamPublish), im specifying action links, as many people do.

Here's the JSON for my action link:

[{ 'text':'Do something on my site', 'href':'http://www.mysite.com/somerestfulpath' }]

Now, we use URL Rewriting on my website, so the URL's are all nice and RESTful (i.e. no .ASPX).

Now, for some reason, the link that gets rendered out on the user's wall is:

http://www.mysite.com/somerestfulpath?ref=nf

Of course this is 404'ing.

It seems to be this way for all Facebook apps (not just mine), that for any custom action link, Facebook will automatically append ref=nf to the URL.

For other parts of the post (links, images, etc), they don't do this.

So the only think i can do is change the link to the un-RESTful URL:

http://www.mysite.com/pages/actualpagewhichidontwantuserstosee.aspx

Then it will render:

http://www.mysite.com/pages/actualpagewhichidontwantuserstosee.aspx?ref=nr

Which works.

But WTF, why are they doing this? And can they not give those applications with URL rewriting an option for them not to supply this?

I was hoping to keep the URL's all clean and rewritten.

EDIT:

My bad, the regex rules on the URL rewriter wasnt correct. Burn.

A: 

PEBKAC (Problem Exists Between Keyboard And Chair).

My regex rules for this particular page was not foolproof enough.

For anyone that cares, this is what i had:

<rewrite url="^~/somepage$" to="~/Pages/SomePage.aspx" processing="stop" />

This is what i changed it to:

<rewrite url="^~/somepage(.*)" to="~/Pages/SomePage.aspx" processing="stop" />

Also, i was wondering why in Fiddler i was getting all these 404 errors coming from Facebook.

Turns out i was registering the 'xd_receiver.htm' wrong:

FB.Init('myapikey', 'xd_receiver.htm')

So on ALL pages, Facebook was looking for the file relative to the path.

It needed to be:

FB.Init('myapikey', '/xd_receiver.htm')

Never forget the '/'. =)

RPM1984