Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- async static void PostRequest(string url)
- {
- IEnumerable<KeyValuePair<string, string>> queries = new List<KeyValuePair<string, string>>()
- {
- new KeyValuePair<string, string>("query1", "number1"),
- new KeyValuePair<string, string>("query2", "number2")
- };
- HttpContent q = new FormUrlEncodedContent(queries);
- using (HttpClient client = new HttpClient())
- {
- using (HttpResponseMessage response = await client.PostAsync(url, q))
- {
- using (HttpContent content = response.Content)
- {
- string mycontent = await content.ReadAsStringAsync();
- HttpContentHeaders header = content.Headers;
- Console.WriteLine(mycontent);
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment