我想在twitter
发布消息。
这是我目前使用的代码:
public void PostTweets(string userName, string password, string updateMessage)
{
using (WebClient wc = new WebClient())
{
wc.Credentials = new NetworkCredential(userName, password);
ServicePointManager.Expect100Continue = false;
byte[] updateMessageBytes = System.Text.Encoding.UTF8.GetBytes("status=" + updateMessage); //Use UTF8 to get it properly encoded if you use characters like ç ã etc...
wc.UploadData("https://dev.twitter.com/docs/api/1/post/statuse/update",updateMessageBytes);
}
}
它给了我一个错误:
The remote server returned an error: (401) Unauthorized.