Andy Brown
Andy Brown

Reputation: 5522

Tweeting from .NET suddenly throws exception

I have a .NET application which has been generating tweets happily for years, but has suddenly (June 2013) started throwing this exception:

Exception of type 'TwitterAPIException' was thrown.

I've read another StackOverflow thread which suggests that the problem might be that I need to escape punctuation characters, so I've rewritten the tweet to exclude any unusual characters. I've tried in IE and Firefox.

At the heart of my code is this (I've missed out various constructors to show the lines to do with Twitter):

Private ConsumerKey As String = System.Configuration.ConfigurationManager.AppSettings("ConsumerKey")
Private ConsumerKeySecret As String = System.Configuration.ConfigurationManager.AppSettings("ConsumerKeySecret")
Private AccessToken As String = System.Configuration.ConfigurationManager.AppSettings("AccessToken")
Private AccessTokenSecret As String = System.Configuration.ConfigurationManager.AppSettings("AccessTokenSecret")


Private Twitter As New TwitterAPI

    'authenticate with Twitter and send
    Twitter.AuthenticateWith(ConsumerKey, ConsumerKeySecret, AccessToken, AccessTokenSecret)

  Try

        'send the tweet
        Twitter.Update(Message)

Anyone any idea what's happening? We tweet once every couple of days on average, and it's all useful and relevant stuff, so there is absolutely no reason that I can see for Twitter to block our account.

Upvotes: 1

Views: 263

Answers (2)

Andy Brown
Andy Brown

Reputation: 5522

Two months on, I have an answer! This excellent post gives a nice simple standalone C# class for people like me who just want to get the code working, and don't really mind what it does. I also found this blog useful to explain what was happening behind the scenes.

Since our ASP.NET website is written using VB, I tried translating the OverPie code into VB, but I just couldn't get it to work properly. In the end I gave up and created a C# class library, and referenced this instead.

I hope this helps someone!

Upvotes: 0

Marc Gravell
Marc Gravell

Reputation: 1064014

Probably where they shut down the 1.0 API. https://dev.twitter.com/blog/api-v1-is-retired

You need to move to 1.1 ASAP.

(it bit us a few days ago too, which is how I knew about it)

Upvotes: 2

Related Questions