I'm trying to upload a picture to Twitpic using TweetSharp and Hammock libraries in a WP7 app. The piece of code which uploads the photo is this:
// Clients.srv is a TweetSharp TwitterClient
RestRequest req = Clients.srv.PrepareEchoRequest();
RestClient client = new RestClient { Authority = "http://api.twitpic.com/", VersionPath = "2" };
req.AddFile("media", e.OriginalFileName, e.ChosenPhoto);
req.AddField("key", "hidden");
req.AddField("message", Tweet.Text);
req.Path = "upload.xml";
req.Method = Hammock.Web.WebMethod.Post;
client.BeginRequest(req, (RestCallback) uploadCompleted);
Some explanation to the code: this comes from a call to photoPickerTask, e
is the event argument which contains the photo name and file (an IO.Stream object). All of this is verified to be working.
The problem is that the response of Twitpic is always "Could not authenticate you: headers rejected by Twitter". The TwitterClient works, the OAuth tokens are all right. The API Key is correct. I don't know if the error comes from my code, from the TweetSharp PrepareEchoRequest()
function or from Twitpic. Can anybody give me a clue?