1

Hi I'm wondering how to post request to a url that accepts form data using System.net.http.

IEnumerable<KeyValuePair<string, string>> pData = new List<KeyValuePair<string, string>>()
{
    new KeyValuePair<string, string>("id", addID[1]),
    new KeyValuePair<string, string>("qtd", addID[2]),
    new KeyValuePair<string, string>("commit", "add")
};
HttpContent formData = new FormUrlEncodedContent(pData);
MultipartFormDataContent postData = new MultipartFormDataContent();
postData.Add(formData);
var postResponse = client.PostAsync(site + "/add", postData);
Gaurang Dave
  • 3,956
  • 2
  • 15
  • 34
  • duplicate, go through this https://stackoverflow.com/questions/4015324/how-to-make-http-post-web-request – Z.R.T. Sep 18 '18 at 03:00
  • 1
    Possible duplicate of [How to make HTTP POST web request](https://stackoverflow.com/questions/4015324/how-to-make-http-post-web-request) – j4rey Sep 18 '18 at 05:21

0 Answers0