Get website header - CSharp Network

CSharp examples for Network:Web

Description

Get website header

Demo Code

using System;//from   ww w  .  j a va 2  s .  c o m
using System.Net.Http;
using System.Threading.Tasks;
using static System.Console;
class Program
{
   static async Task Main(string[] args)
   {
      var client = new HttpClient();
      HttpResponseMessage response = await client.GetAsync("http://www.book2s.com/");
      WriteLine($"Apple's home page has {response.Content.Headers.ContentLength:N0} bytes.");
   }
}

Related Tutorials