Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Methode post request
- async void PostRequest()
- {
- IEnumerable<KeyValuePair<string, string>> queries = new List<KeyValuePair<string, string>>()
- {
- new KeyValuePair<string,string>("query1","Abdessalam"),
- new KeyValuePair<string,string>("query2","Kilya")
- };
- HttpContent q = new FormUrlEncodedContent(queries);
- using (HttpClient client = new HttpClient())
- {
- using (HttpResponseMessage response = await client.PostAsync("https://posttestserver.com/post.php", q))
- {
- using (HttpContent content = response.Content)
- {
- string mycontent = await content.ReadAsStringAsync();
- Console.WriteLine(mycontent);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement