Take the 2-minute tour ×

I'm working on an Application that communicates with the Twitter API using Hammock. I'm able to authenticate using Aouth and I can return the token and the token secret. However when I try to get twitter mentions or post an update, I get a 400 error. From googling, I get that the problem has to do with System.net.HttpWebrequest according to this article http://codeknowledge.net/2011/11/03/httpwebrequest-authentication-error-400/

however I don't get how to override the default and use the custom as described in the link above.

Here is my error details: Any help would be appreciated

The remote server returned an error: (400) Bad Request.System.Net.HttpWebResponse protocolerror

Stack trace:

at System.Net.HttpWebRequest.GetResponse()
at Hammock.Web.WebQuery.ExecuteGetDeleteHeadOptions(WebRequest request, WebException& exception) in D:..........\hammock-master\src\net35\Hammock\Web\WebQuery.cs:line 1022

query.Result.Exception.TargetSite: {System.Net.WebResponse GetResponse()}

share|improve this question
Is it possible to get more information about the bugging requests and your code please ? It would be quite useful to solve the problem. –  air-dex Jan 19 '13 at 1:47

1 Answer 1

According to Twitter Developer's documentation about error response codes, it may be due to the following things :

  • If you use the 1.0 API, you have already hit the rate limit and you must wait to launch new requests.
  • If you use the 1.1 API, the Authorize header which is used for authentication is missing. Are your requests authenticated correctly ?
  • Your request can be invalid. Are your URL, headers, GET and POST arguments OK ?

Your error message indicates a "protocolerror" too. Does your URL start with "https://api.twitter.com/" ?

The answer will be edited if I have more information when I have them.

share|improve this answer
I used tweetsharp and stepped through the code and compared to when I stepped through the code using just Hammock, I think there is a part I'm skipping or missing. so the last two points make sense. in the mean time I'm using Tweetsharp since it's working and I want to go to market quickly, then I will come back to this. Thanks –  cgitosh Jan 21 '13 at 9:59

Your Answer


