This project has moved and is read-only. For the latest updates, please go here.

Failing to connect to the API via LinqToTwitter (maybe SSL prob?)

Mar 20, 2015 at 4:51 PM
I have implemented this code using the latest version of LinqToTwitter from NuGet:
auth = new AspNetAuthorizer
                CredentialStore = new SessionStateCredentialStore
                    ConsumerKey = System.Configuration.ConfigurationManager.AppSettings["consumerKey"],
                    ConsumerSecret = System.Configuration.ConfigurationManager.AppSettings["consumerSecret"]
                GoToTwitterAuthorization =
                    twitterUrl => Response.Redirect(twitterUrl, false)
            var ctx = new TwitterContext(auth);

            var mytweets = await ctx.Search.Where(t => t.Type == SearchType.Search && t.Query == "paulpitchford").ToListAsync();
On this page:

It seems to fail because the site can't make a SSL connection. I can't make it connect in debug either. Detail:

An error occurred while sending the request. The underlying connection was closed: An unexpected error on a receive.

The keys are correct but I just can't get this to work. My context, method and page are all marked as async as I understand the latest version of LinqToTwitter is async. I just cannot seem to make a connection to receive any tweets.

Any help really would be appreciated.


Mar 23, 2015 at 8:09 PM

Does it work if you call:
before instantiating your TwitterContext. If that doesn't work, are you able to get one of the demos working from the downloadable source code?

Mar 23, 2015 at 8:15 PM
I also noticed that you're using AspNetAuthorizer. The downloadable source code has a demo for ASP.NET. Essentially, you'll have to break your oath handling into two pieces because of the nature of the Web. 1) start authoriization, passing the callback URL 2) In the callback handler, complete the authorization process. OAuth is somewhat complex, so I've written some documentation at

and a FAQ, which contains help on 401 errors, at

Aug 11, 2015 at 3:41 PM

I've only just re-picked this project up having been busy on another couple of projects. Turns out for some reason I had a proxy setup in web.config which was blocking access. I have no idea what it was doing in there? I didn't even know you could do that? I'm wondering if some rouge nuget package installed it. Anyway, it's working now but I wanted to thank and aknowledge your help.

Kind Regards,