C# HttpClient GET request

C# HttpClient GET request

 

using System;
using System.Net.Http;
using System.Threading.Tasks;

namespace usingcsharp
{
    class Program
    {
        static async Task Main(string[] args)
        {
            using var client = new HttpClient();
            var contents = await client.GetStringAsync("http://usingcsharp.com");
            Console.WriteLine(contents);
        }
    }
}

 

It outputs the simple HTML code of the home page.

2021-10-03