[twitter-dev] Posting Comments using OAuth in C#.NET

2010-08-06 Thread Siva Shunmugam
Hi Guys,

can you give me some sample code which posts the comments to the
twitter using OAuth.

Thanx.
Siva


[twitter-dev] Remote Server Error : 403 Forbidden

2010-08-06 Thread Siva Shunmugam
Hi Guys,

I have created a code which posts the comments to the twitter.. but
the code was posting only for the first time... and from the next time
itz throwing Remote Server Error : 403 Forbidden error. I am
experiencing this issue only for the past two day.. previously it was
working properly..

Let me know your feedback..

Here is my code which I have used

HttpWebRequest request = null;
WebResponse webResponse = null;
Stream reqStream = null;

try
{

XmlDocument result = new XmlDocument();
string user =
Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(username +
: + password));

byte[] bytes =
System.Text.Encoding.ASCII.GetBytes(status= + description);
request = (HttpWebRequest)WebRequest.Create(@http://
twitter.com/statuses/update.xml);
request.Method = POST;
request.ServicePoint.Expect100Continue = false;
request.Headers.Add(Authorization, Basic  + user);
request.ContentType = application/x-www-form-
urlencoded;
request.ContentLength = bytes.Length;


reqStream = request.GetRequestStream();
reqStream.Write(bytes, 0, bytes.Length);
reqStream.Close();

webResponse = request.GetResponse();
using (StreamReader sr = new
StreamReader(webResponse.GetResponseStream()))
{
result.Load(sr.BaseStream);
sr.Close();
}

Thanx..
Siva