How to send a HEAD request with WebClient in C#?

20 views Asked by At

I'm trying to download just the headers of the response. I wanted to use the HTTP HEAD method like this:

var response = client.UploadString(url, "HEAD", string.Empty);

Unfortunately this code throws

ProtocolViolationException: Cannot send a content-body with this verb-type.

How can I do this properly?

0

There are 0 answers