1

So I've set up everything to invite users to the registration page on my site and track their invitation code, but now whenever a user accepts the invitation they end up getting the following error:

HTTP Error 404.0 - Not Found

The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.

And here's the URL:

http://www.facebook.com/dialog/oauth/?state=eyJyIjoiaHR0cDovL2FwcHMuZmFjZWJvb2suY29tL2Zpc2hhcndlLz9yZXF1ZXN0X2lkcz0xMDE1MDYzNzQzNDI4NTQ4NCwxMDE1MDYzNzU3NjA0MDQ4NCwxMDE1MDYzNzU4MDQ1NTQ4NCwxMDE1MDYzNzU5NzQ2MDQ4NCwxMDE1MDYzNzYxNDUyMDQ4NCwxMDE1MDYzNzYzMDg0NTQ4NCZyZWY9bm90aWYmbm90aWZfdD1hcHBfcmVxdWVzdCJ9&client_id=217174461634478&redirect_uri=http://www.fisharwe.com/facebookredirect.axd

Why is the redirect_uri http://www.fisharwe.com/facebookredirect.axd and not what I've set in my code using top.location.href="whatever.com"?

UPDATE:

Seems like that problem has been resolved somehow. But it still does not redirect to the registration page of my site! Here's the source code of the landing page:

<html><head><script type="text/javascript"> top.location = "http://www.facebook.com/dialog/oauth/?state=eyJyIjoiaHR0cDovL2FwcHMuZmFjZWJvb2suY29tL2Zpc2hhcndlLz90eXBlPWRpc2NvdmVyeSJ9&client_id=217174461634478&redirect_uri=http://www.fisharwe.com/facebookredirect.axd"; </script></head><body></body></html>

UPDATE2:

This is my C# code:

    [CanvasAuthorize]
    public ActionResult Index()
    {
        var fb = new FacebookWebClient(FacebookWebContext.Current);
        dynamic requestInfo = fb.Get("/me/apprequests/");
        var b = requestInfo.Count;
        if (requestInfo.data.Count > 0)
        {
            var a = requestInfo["data"][0]["data"];
            //ViewData.Add("TrackingData", a);
            return Redirect(redirectUrl + "?code=" + a);
        }
        return RedirectToAction("Index", "Home");
    }
Kassem
  • 8,116
  • 17
  • 75
  • 116

1 Answers1

0

have you setup the http handler in web.config?

<httpHandlers>
    <add verb="*" path="facebookredirect.axd" type="Facebook.Web.FacebookAppRedirectHttpHandler, Facebook.Web" />
</httpHandlers>
prabir
  • 7,674
  • 4
  • 31
  • 43
  • @prabir: Yes I did. The Facebook C# SDK did that for me I believe... I also set the Site URL in the Application configuration (back in FB), do I need to set it in the web.config as well? And what should it be, the root of my site (ex: www.mysite.com) or the route I want to redirect users to (ex: www.mysite.com/Register)? – Kassem May 24 '11 at 07:24
  • @prabir: I've updated my question, please take a look into it. Thank you. – Kassem May 24 '11 at 08:18
  • can u paste the C# code too. Best is to look at "Samples" folder from the source code which includes different scenarios. – prabir May 25 '11 at 02:19
  • @prabir: I've pasted my C# code. I also downloaded the source code and checked out the sample projects. Unfortunately, they do not go beyond the basics of authentication and posting on the wall. Is there some tutorial/sample which demonstrates how to post an item using an AJAX call? This signed_request thing is driving me crazy! Check this out please: http://facebooksdk.codeplex.com/discussions/258480 – Kassem May 25 '11 at 11:44
  • @prabir: I've just tested it with my friend and it seems like it's kind of working now. But, the problem is that the site opens INSIDE facebook (as a frame I guess), while what I really want is to redirect the whole page to the registration page of my site. – Kassem May 25 '11 at 12:21
  • read this discussion on how to maintain signed_request during ajax calls. http://facebooksdk.codeplex.com/discussions/251878 – prabir May 25 '11 at 16:06
  • to redirect the whole page, make sure to set the target of anchor tag to top. why do u want it to be in whole new page if you are using canvas app? canvas apps are meant to be iframe running inside fb.com – prabir May 25 '11 at 16:09
  • @prabir: I've already read that discussion and that's where I knew about the signed_request in the first place. But, the problem is that signed_request is ALWAYS null, because the application never asked the user to login to fb in the first place. This is why I thought I'd do the following instead: http://stackoverflow.com/questions/6126517/retrieve-access-token-using-javascript-api – Kassem May 25 '11 at 16:13
  • @prabir: I do not really want a canvas app, I just want to use the app for integration purposes: allow users to post stuff on their walls (via my site) and invite their fb friends to register at my site. – Kassem May 25 '11 at 16:15