OAutheException Facebook C#SDK ie9
我在我的facebook应用程序中使用以下代码。在facebook上加载应用程序时,在chrome/firefox/ie8中没有问题。当它在IE9中运行时,它报告已抛出OAutheExceptionOAutheException Facebook C#SDK ie9,c#,facebook,facebook-c#-sdk,C#,Facebook,Facebook C# Sdk,我在我的facebook应用程序中使用以下代码。在facebook上加载应用程序时,在chrome/firefox/ie8中没有问题。当它在IE9中运行时,它报告已抛出OAutheException public string GetFacebookId() { if (!FacebookWebContext.Current.IsAuthorized()) return string.Empty; var clie
public string GetFacebookId() {
if (!FacebookWebContext.Current.IsAuthorized())
return string.Empty;
var client = new FacebookWebClient();
dynamic me = client.Get("me");
return me.id;
}
如有任何建议,将不胜感激
谢谢
编辑:
window.fbAsyncInit = function () {
FB.init({
appId: '@(Facebook.FacebookApplication.Current.AppId)', // App ID
//channelURL: '//facebook.thefarmdigital.com.au/moccona/premium/FacebookChannel/', // Channel File
status: true, // check login status
cookie: true, // enable cookies to allow the server to access the session
oauth: true, // enable OAuth 2.0
xfbml: true // parse XFBML
});
FB.Canvas.setAutoGrow();
};
$(function () {
$('#custom_login').click(function () {
FB.getLoginStatus(function (response) {
if (response.authResponse) {
//should never get here as controller will pass to logged in page
} else {
FB.login(function (response) {
if (response.authResponse) {
window.location = '@(Request.Url.AbsoluteUri.Replace(Request.Url.PathAndQuery, ""))' + $('#custom_login').attr('href');
} else {
window.location = '@(Request.Url.AbsoluteUri.Replace(Request.Url.PathAndQuery, ""))' + $('#custom_login').attr('dataFail');
}
}, { scope: 'publish_stream' });
}
});
return false;
});
});
我不熟悉FB的C#SDK,但从您提供的代码来看,您似乎没有使用FB进行任何用户身份验证。它在Chrome和Firefox中工作可能只是因为你已经在这些浏览器中登录到你的FB应用程序。当它在IE9中运行时,你对
的意思是什么?
?这是一个在更大应用程序中运行的代码示例。该方法用于返回用户facebook id。在firefox中浏览应用程序时,将返回该id。当在IE9中浏览时,它会返回上面的异常。您是否需要更多信息?或者你只是想因为你今天过得不好而投反对票?不,也许你想用一个更好的术语。当你说它在IE9中运行时,我知道你有一个在浏览器上下文中运行的插件“应用程序”是一个宽泛的术语,并不意味着一般意义上的网络应用程序。嘿,如果你是个混蛋,那你就有点傻了。谢谢你的帖子:。授权在其他浏览器中工作。我已经更新了我的问题,包括fbinit和登录请求。我环顾了一下四周,似乎这是一个与我类似的问题。。我会让你知道事情的进展。
window.fbAsyncInit = function () {
FB.init({
appId: '@(Facebook.FacebookApplication.Current.AppId)', // App ID
//channelURL: '//facebook.thefarmdigital.com.au/moccona/premium/FacebookChannel/', // Channel File
status: true, // check login status
cookie: true, // enable cookies to allow the server to access the session
oauth: true, // enable OAuth 2.0
xfbml: true // parse XFBML
});
FB.Canvas.setAutoGrow();
};
$(function () {
$('#custom_login').click(function () {
FB.getLoginStatus(function (response) {
if (response.authResponse) {
//should never get here as controller will pass to logged in page
} else {
FB.login(function (response) {
if (response.authResponse) {
window.location = '@(Request.Url.AbsoluteUri.Replace(Request.Url.PathAndQuery, ""))' + $('#custom_login').attr('href');
} else {
window.location = '@(Request.Url.AbsoluteUri.Replace(Request.Url.PathAndQuery, ""))' + $('#custom_login').attr('dataFail');
}
}, { scope: 'publish_stream' });
}
});
return false;
});
});