我想在vb.net中使用Facebook C#SDK構建一個Facebook WebApp。這個SDK可以用於vb.net,我知道。不過,我試圖讓我的應用程序登錄頁面加載。我可以讓它登錄,但是我的應用程序不能識別它已經登錄,並繼續循環登錄,直到我停止它。這是我的代碼。Facebook-C#-SDK不會停止「登錄」
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim faceauth As New FacebookClient
Dim fbsession As New FacebookSession
If faceauth.AccessToken.Length = 0 Then
Dim appId As String = ConfigurationManager.AppSettings("facebookappid")
Dim extendedPermissions As String() = {"publish_stream", "offline_access", "read_stream", "manage_pages"}
Dim oauth = New FacebookOAuthClient() With { _
.ClientId = appId _
}
fbsession.Expires = Now.AddDays(1)
Dim parameters = New Dictionary(Of String, Object)() From { _
{"response_type", "code_and_token"}, _
{"display", "popup"}, _
{"redirect_uri", "http://newsocialspin.spintest.com/fbcsb.aspx"} _
}
If extendedPermissions IsNot Nothing AndAlso extendedPermissions.Length > 0 Then
Dim scope = New StringBuilder()
scope.Append(String.Join(",", extendedPermissions))
parameters("scope") = scope.ToString()
End If
Dim loginUrl = oauth.GetLoginUrl(parameters)
Response.Redirect(loginUrl.ToString)
Else
LoggedIn()
End If
End Sub
我已經嘗試了無數不同的方法讓它識別登錄狀態無濟於事。如果您有任何想法可以幫助,請告訴我,或者如果您的開發人員請糾正我明顯的錯誤。謝謝。