移动版的Facebook应用进入重定向循环

问题描述:

我已经开发了一个使用C#SDK的Facebook应用程序,它的工作正常。现在我也想在手机上启用它,所以我试图将移动网址设置为与我的画布网址(这是一个cloudapp.net地址)相同的。但是,当我尝试从移动设备访问它,似乎进入一个重定向循环涉及我的画布url,apps.facebook url和m.facebook / apps url。有时候它出来了,我得到了一个Facebook错误消息说:由于配置错误,该应用的移动版本不可用,似乎被抓到一个重定向环路。

I have developed a Facebook app using the C# SDK and it is working fine. Now I want to also enable it on mobiles, so I tried to set the "mobile url" to the same one as my canvas url (which is a cloudapp.net address). However, when I try to access it from a mobile, it seems to go into a redirect loop involving my canvas url, the apps.facebook url and the m.facebook/apps url. Sometimes it goes out of the loop and I get the facebook error message saying : "the mobile version of the app is unavailable because it is misconfigured. It appears to be caught in a redirect loop."

我认为这可能与webconfig文件中的facebooksetting指定我的cloudapp页面应该重定向到apps.facebook.com页面,然后重定向到移动网址等等。有人可以告诉我如何解决这个问题 - 我只想让我的手机网址与我的画布网址一样。

I think it may have to do with the fact that the facebooksettings in the webconfig file specify that my cloudapp page should redirect to the apps.facebook.com page, which then redirects to the mobile url and so on. Can someone tell me how to solve this problem - I just want my mobile url to be the same as my canvas url.

谢谢。

如果请求是从手机添加额外的逻辑

If the request is from mobile add extra logic

对于v6,

var fb = new FacebookClient();
var desktopLoginUrl = fb.GetLoginUrl(new { .... });
var mobileLoginUrl = fb.GetLoginUrl(new { ...., mobile = true });

对于v5,

var urlBuilder = new UrlBuilder(oauthClient.GetLoginUrl(...));
urlBuilder.Host = "m.facebook.com";
var loginUrl = urlBuilder.Uri;