I have an issue I have been trying to fix since this morning (now over 8h). I got the facebook cookie contents, found the auth token which works fine on its own in the browser
But
Whenever I try to get the user information, the web-page crashes down very nicely with the error below.
I have tried to read from the page using web request:
'Dim inputFile As String = "https://graph.facebook.com/me?access_token=" & access_token
'Dim sDiskFile As String = "auth.txt"
'Dim _wrequest As WebRequest = WebRequest.Create(inputFile)
'Dim _wresponse As WebResponse
'_wresponse = _wrequest.GetResponse()
'Dim _stream As Stream = _wresponse.GetResponseStream()
'Dim oReader As New StreamReader(_stream, Encoding.ASCII)
And it crashed with the same error. I decided to give the Facebook SDK 5 a go and the same error is happening:
Dim access_token As String = GetFacebookTokenFromCookie()
If access_token = "" Then
litUser.Text = "<fb:login-button perms='email'>Login with Facebook</fb:login-button>"
Else
Dim app As New DefaultFBApp
Dim _ctx As New FacebookWebContext(app)
Dim fb As New Facebook.FacebookClient(app)
fb.AccessToken = access_token
Dim parameters As New Dictionary(Of String, Object)()
parameters("fields") = "id,name"
Dim result As Object = fb.Get(parameters)
Dim id = result.id
Dim name = result.name
Dim firstName As String = result.first_name
Dim lastName = result.last_name
Dim link = result.link
Dim username = result.username
Dim gender = result.gender
Dim male = result.locale
litUser.Text = "Welcome " & firstName
End If
DefaultFBApp is:
Public Class DefaultFBApp
Implements Facebook.IFacebookApplication
With all the must-implement fields added in and the api key and secret filled in.
Same error:
Server Error in '/' Application.
A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 69.171.224.21:443
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Net.Sockets.SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 69.171.224.21:443
Source Error:
Line 25: parameters("fields") = "id,name"
Line 26:
Line 27: Dim result As Object = fb.Get(parameters)
Line 28:
Line 29: Dim id = result.id
Source File: masterpage.master Line: 27
Stack Trace:
[SocketException (0x274c): A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 69.171.224.21:443]
System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress) +239
System.Net.Sockets.Socket.InternalConnect(EndPoint remoteEP) +35
System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Int32 timeout, Exception& exception) +224
[WebExceptionWrapper: Unable to connect to the remote server]
FluentHttp.HttpHelper.OpenRead() +191
Facebook.FacebookClient.Api(String path, IDictionary`2 parameters, HttpMethod httpMethod, Type resultType) +253
Facebook.FacebookClient.Get(IDictionary`2 parameters) +44
ASP.masterpage_master.Page_Load(Object sender, EventArgs e) in E:\kunden\homepages\6\d364763622\www\wsb6301158401\masterpage.master:27
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35
System.Web.UI.Control.OnLoad(EventArgs e) +99
System.Web.UI.Control.LoadRecursive() +50
System.Web.UI.Control.LoadRecursive() +141
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627
Version Information: Microsoft .NET Framework Version:2.0.50727.5446; ASP.NET Version:2.0.50727.5420
Any help would be mostly appreciated