To make an HTTP GET request in C#, you can use the HttpClient class from the System.Net.Http namespace. Here is an example code:
main.cs663 chars25 lines
This code creates an instance of HttpClient and uses its GetAsync method to send a GET request to the specified URL. The response is returned as an HttpResponseMessage object, from which you can extract the response body as a string using the ReadAsStringAsync method. In this example code, the main function calls the MakeGetRequest function and prints the response to the console.
gistlibby LogSnag