C# HttpClient HEAD request

C# HttpClient HEAD request

The HTTP HEAD method requests the headers that are returned if the specified resource would be requested with an HTTP GET method.

 

using System;
using System.Net.Http;

var url = "https://usingcsharp.com";
using var client = new HttpClient();
var results = await client.SendAsync(new HttpRequestMessage(HttpMethod.Head, url));
Console.WriteLine(results);

 

 

 

 

2021-10-03