Hi All
I am trying to implement a simple Twitter client. I am able to get the status but when I try to Update it I am getting 403 Error from Twitter, here is the code I am using
string uri = "http://twitter.com/statuses/update.xml";
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri);
request.Method = "POST";
request.Credentials = new NetworkCredential("username", "password");
request.ContentType = "application/x-www-from-urlencoded";
string postData = "status=Sample Status";
byte[] encodedData = new ASCIIEncoding().GetBytes(postData);
request.ContentLength = encodedData.Length;
Stream requestStream = request.GetRequestStream();
requestStream.Write(encodedData, 0, encodedData.Length);
//I am getting error from the next statement
//Error : The remote server returned an error: (403) Forbidden.
using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
{
using (StreamReader reader = new StreamReader(response.GetResponseStream()))
{
/*
More code
*/
Please help
Thanks
Anuraj P
http://www.dotnetthoughts.net
THIS POSTING IS PROVIDED "AS IS" WITH NO WARRANTIES, AND CONFERS NO RIGHTS.
BEWARE OF BUGS IN THE ABOVE CODE; I HAVE ONLY PROVED IT CORRECT, NOT TRIED IT.