Creating and sending an HTTP GET request C# with Example
using System.Net; using System.IO; ... string requestUrl = "https://www.example.com/page.html"; HttpWebRequest request = HttpWebRequest.CreateHttp(requestUrl); // Optionally, set properties of the HttpWebRequest, such as: request.AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate; request.Timeout = 2 * 60 * 1000; // 2 minutes, in milliseconds // Submit the request, and get the response body. string responseBodyFromRemoteServer; using (HttpWebResponse response = (HttpWebResponse)request.GetResponse()) { using (StreamReader reader = new StreamReader(response.GetResponseStream())) { responseBodyFromRemoteServer = reader.ReadToEnd(); } }