Question

I am currently working on a web application project, and I need to upgrade the twitterizer work with LinqToTwitter in order to update the status of a particular user. I have tried different codes, but none of them has worked for me.

Here is one of the examples:

   protected void Page_Load(object sender, EventArgs e)
        {
        var auth = new SingleUserAuthorizer
            {
                Credentials = new InMemoryCredentials
                {
                    ConsumerKey = "YourAppConsumerKey",
                    ConsumerSecret = "YourAppConsumerSecret",
                   OAuthToken = "AccessToken",
                   AccessToken = "AccessTokenSecret"
                }
            };

     var ctx = new TwitterContext(auth); 
        ctx.UpdateStatus("hi there!");
}

When I run the code for the first time, nothing will happen. Afterwards, when I try to run the code for the second time, I get error 403, and I keep getting that error unless I change the UpdateStatus content, and the same problem will happen again.

Does anyone have an idea about that issue?

Was it helpful?

Solution

Twitter will only allow you to post a certain message one time. That means if you've ever tweeted "hi there!" in the past, you can't tweet it again. Because of this, I typically write my test messages to append a DateTime.Now to guarantee unique text.

To help out, the downloadable source code has a project called LinqToTwitterDemos. This project contains examples of using all authorizers and much more. There's also demo code on the Releases page and the Samples page.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top