我有同樣的問題,以及從下面的例子中,我的問題竟然是,關於我的FacebookLogin.ashx處理程序頁面,我被重定向回到我原來的aspx頁面,其中包含我的JavaScript代碼。在輸入此代碼後,JavaScript再次執行我的身份驗證,因此將我置於無限循環中。
我最終做的是抓取一些JavaScript的副本,它爲您提供來自here的JavaScript中的永久性會話變量。併爲提交帖子的代碼添加條件。這樣我只擊中了FacebookLogin.ashx處理程序一次,不會讓我陷入循環。
這裏是我使用的代碼:
FB.Event.subscribe('auth.authResponseChange', function (response) {
if (response.status === 'connected') {
// the user is logged in and has authenticated your
// app, and response.authResponse supplies
// the user's ID, a valid access token, a signed
// request, and the time the access token
// and signed request each expire
var uid = response.authResponse.userID;
var accessToken = response.authResponse.accessToken;
if (sessvars.fbauthenticated == undefined) {
sessvars.fbauthenticated = "1";
// Do a post to the server to finish the logon
// This is a form post since we don't want to use AJAX
var form = document.createElement("form");
form.setAttribute("method", 'post');
form.setAttribute("action", '/FacebookLogin.ashx');
var field = document.createElement("input");
field.setAttribute("type", "hidden");
field.setAttribute("name", 'accessToken');
field.setAttribute("value", accessToken);
form.appendChild(field);
document.body.appendChild(form);
form.submit();
}
} else if (response.status === 'not_authorized') {
// the user is logged in to Facebook,
// but has not authenticated your app
} else {
// the user isn't logged in to Facebook.
}
});
凡條件行,如果(sessvars.fbauthenticated ==未定義){保持我的代碼可以發佈多次到服務器。
希望這可以幫助
你解決了這個問題嗎?我擁有相同的內容,並且與Chrome或IIS Cookie無關。 – 2012-08-14 16:56:40
同樣的問題在這裏,從ashx重新引導並且腳本一遍又一遍地運行,無限循環 - 任何可以解決這個問題而無需sessionvars的建議? – 2013-01-11 14:48:43