What about a simple
var response = await client.GetAsync("URL?username=user&password=password");
?
Question
I've managed the sending values with POST method like the following.
var values = new List<KeyValuePair<string, string>>
{
new KeyValuePair<string, string>("username", "user"),
new KeyValuePair<string, string>("password", "password"),
}; var client = new HttpClient(new HttpClientHandler());
HttpResponseMessage response = await client.PostAsync("URL", new FormUrlEncodedContent(values));
But now the method where i send the request is a GET and i need to send values like the POST to get the response otherwise it returns an error. can anyone help of how to send values with GET method ? thank you.
Solution
What about a simple
var response = await client.GetAsync("URL?username=user&password=password");
?