Hi,
I'm trying to create an application to test Twitter and have a problem.
When I call my uri in the sandbox I got a correct response.
The same happens when I test uri directly from a browser's address bar.
Unfortunately for some reason it does not work from my application (which is registered in Twitter).
The link is this: http://api.twitter.com/1/statuses/user_timeline.json?include_entities=true&include_rts=true&screen_name=tomaszsapalski&count=2
Now the most important thing to mention is that my work environment is behind proxy and I have to deal with it.
My code in C# looks like that:
string tokenQuery = String.Empty;
try
{
tokenQuery = "http://api.twitter.com/1/statuses/user_timeline.json?include_entities=true&include_rts=true&screen_name=tomaszsapalski&count=2";
HttpWebRequest request = createWebRequest(tokenQuery);
request.Method = "GET";
HttpWebResponse response = (HttpWebResponse)req.GetResponse();
//that last line throws an exception: "The remote server returned an error: (400) Bad Request."
}
catch (Exception ex)
{
//ex.Message = "The remote server returned an error: (400) Bad Request."
//request = http://api.twitter.com/1/statuses/user_timeline.json?include_entities=true&include_rts=true&screen_name=tomaszsapalski&count=2
}
createWebRequest is a method where I set up my proxy settings:
protected static HttpWebRequest createWebRequest(string query)
{
HttpWebRequest req;
try
{
req = (HttpWebRequest)HttpWebRequest.Create(query);
IWebProxy iproxy = WebRequest.GetSystemWebProxy();
iproxy.Credentials = CredentialCache.DefaultCredentials;
req.Proxy = iproxy;
req.PreAuthenticate = true;
}
catch (Exception)
{
req = null;
}
return req;
}
I appreciate any help as I can't make Twitter working at all from my app.
Thanks.
TS.

Replies
Just a possibility, mostly because I have noticed this when hitting my test site a lot, is that you may be rate limited if you are sending the request a lot. While twitter's error code page says "an accompanying error message will explain why", this doesn't appear to be the case. The text simply says Bad Request.
https://dev.twitter.com/docs/error-codes-responses
I had similar problem with c#
There is a sample on
Http://codeknowledge.net/2011/11/03/httpwebrequest-authentication-error-400/