My code:
string json = BuildJson(uploadItem);
using (var client = new HttpClient())
{
var values = new List<KeyValuePair<string, string>>();
values.Add(new KeyValuePair<string, string>("parameter", json));
var content = new FormUrlEncodedContent(values);
var response = await client.PostAsync(App.Current.LoginUrl, content);
var responseString = await response.Content.ReadAsStringAsync();
}
My json string includes an base64 encoded image so the FormUrlEncodedContent
throws the exception :
" Invalid URI: The Uri string is too long".
Important is that the server expects exact this format with "parameter" as post key and the json as the post value. How can I bypass this limitation of FormUrlEncodedContent
?