I have tried the same with a web application, it is working. But while I am doing the same in c# windows application the response given is
Unable to publish to Twitter.
async Task<Tuple<int, string>> SendImage(string URL, MultipartFormDataContent multipartContent)
{
using (var httpClient = new HttpClient())
{
httpClient.DefaultRequestHeaders.Add("Authorization", PrepareOAuth(URL, null, "POST"));
var httpResponse = await httpClient.PostAsync(URL, multipartContent);
var httpContent = await httpResponse.Content.ReadAsStringAsync();
return new Tuple<int, string>(
(int)httpResponse.StatusCode,
httpContent
);
}
}
On httpResponse code I get below shown error.
Unknown error publishing to TwitterError
Have you thought of using a library like Tweetinvi. Here is how to both upload the photo and publish the tweet.
Documentation for upload