Когда я пытаюсь выполнить код,
Ошибка: System. UriFormatException: InvalidURI: строка Uri слишком длинная.
Код: Выделить всё
if (Input.Text.Replace(" ", "").Length == 0) {
PGD.Content = "You must fill out the text box!";
return;
}
try
{
using (var wc = new HttpClient())
{
wc.DefaultRequestHeaders.Add("User-Agent", "FlameIgniterDPasteTool");
var x1 = new MultipartFormDataContent
{
{ new StringContent(Uri.EscapeDataString(Input.Text), Encoding.UTF8, "application/x-www-form-urlencoded"), "content" }
};
HttpResponseMessage res = await wc.PostAsync("https://dpaste.com/api/", x1);
PGD.Content = res.Content.ReadAsStringAsync();
}
}
catch (Exception ex) {
PGD.Content = "Error: " + ex.ToString();
}
Progress.IsEnabled = false;
await Task.Delay(1000);
Progress.IsEnabled = true;
Подробнее здесь: https://stackoverflow.com/questions/791 ... ge-payload