How to make a POST request with a minimum of scribbling? Interested in urlencoded
and multipart
. Like this:
http.PostAsync("http://ya.ru", new PostData() { {"1", "2"}, {"3", "4"}, });
new WebClient().UploadValues("http://ya.ru", new NameValueCollection() { {"1", "2"}, {"3", "4"} });
HttpClient
is the base class for rest services clients. He is able to serialize the data himself (to some extent). WebClient is just a helper for sending standard types of requests, but it’s better not to expect any strong typing or serialization from it. It all depends on what and where you are going to send requests. The question was about "less scribbling," so probably WebClient
better. - PashaPash ♦Source: https://ru.stackoverflow.com/questions/438652/
All Articles