0
在我的aspx頁面中,我有一個模式彈出框中的Facebook登錄按鈕。當用戶點擊並登錄時,我使用Facebook C#sdk捕獲登錄細節。在登錄之前,我顯示登錄div和登錄後showine用戶div。facebook登錄後頁面不會重新加載ie ie
它適用於除IE以外的所有瀏覽器。登錄模式彈出窗口後關閉但頁面不重新加載。本地它甚至在IE中也能正常工作。但在facebook應用登錄後,用戶div不顯示。請幫忙。
aspx code below
<div class="fb-login-button" onlogin="javascript:Reload();" scope="email,publish_stream,manage_pages,offline_access" onclick="document.getElementById('divWait').style.display = 'block';" >Login with Facebook</div>
我的javascript代碼如下。
<script > (function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId=221678077921242";
fjs.parentNode.insertBefore(js, fjs);
} (document, 'script', 'facebook-jssdk'));</script>
<script>
window.fbAsyncInit = function() {
FB.init({
appId: '311257055585019',
channelUrl: '//WWW.YOUR_DOMAIN.COM/channel.html', // Channel File
status: true, // check login status
cookie: true, // enable cookies to allow the server to access the session
xfbml: true, // parse XFBML
oauth: true
});
};
(function(d) {
var js, id = 'facebook-jssdk'; if (d.getElementById(id)) { return; }
js = d.createElement('script'); js.id = id; js.async = true;
js.src = "//connect.facebook.net/en_US/all.js";
d.getElementsByTagName('head')[0].appendChild(js);
} (document));
</script>
<script type="text/javascript">
function Reload() {
window.location.href = "urlred.aspx?page=delmode.aspx&fb=1";
}
</script>
我的asp.net代碼如下
FacebookWebContext wc = new FacebookWebContext(new FBSettings() { AppId = ConfigurationSettings.AppSettings["LogApi"].ToString(), AppSecret = ConfigurationSettings.AppSettings["LogSecret"].ToString() });
Facebook.Web.FacebookWebClient cl = new Facebook.Web.FacebookWebClient(wc);
if ((wc.Session != null && wc.Session.AccessToken != null && iLogin == 1))
{Facebook.JsonObject fbUser = (Facebook.JsonObject)cl.Get("/me");
if (fbUser.Count > 0)
{
//do other work
}
}