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.

Was it helpful?

Solution

What about a simple

var response = await client.GetAsync("URL?username=user&password=password");

?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top