0

I have a simple piece of code that sends out a Tweet. Keeping the message with the % signs in it causes a 401 Unauthorized error:

class Program
{
    static void Main(string[] args)
    {
        var test = new TwitterService("ConsumerKey", "ConsumerSecret", "Token", "TokenSecret");

        try
        {
            // "Test 1, So, I know there's no #inflation and so on...but the 10y inflation swap just went to 2.80%. 5y CPI 5y forward is 3.15%. Hmmm."
            test.SendTweet(WebUtility.HtmlEncode("Test 3, So, I know there's no #inflation and so on...but the 10y inflation swap just went to 2.80%. 5y CPI 5y forward is 3.15. Hmmm."));
        }
        catch (Exception ex)
        {
            if (ex.Message.Equals(""))
            {

            }
        }
    }
}

If I send the same message through TweetDeck or directly using the Twitter page, it posts with no problems. Any ideas?

Marc
  • 3,905
  • 4
  • 21
  • 37
Rob
  • 1,390
  • 1
  • 12
  • 25

1 Answers1

0

Looks like you have to use a % instead of the regular % sign.

Rob
  • 1,390
  • 1
  • 12
  • 25