This the the curl request I need to make in C#:
curl -X PURGE http://www.example.com/image.jpg
It is the PURGE part that is throwing me off, I was going to do this in RestSharp but WebClient or whatever will work just fine as well.
This the the curl request I need to make in C#:
curl -X PURGE http://www.example.com/image.jpg
It is the PURGE part that is throwing me off, I was going to do this in RestSharp but WebClient or whatever will work just fine as well.
I find HttpClient
to be a convenient way to send requests these days. The key is to recognize that you can create a custom HttpMethod by passing a string to its constructor.
using (var client = new HttpClient())
using (var request = new HttpRequestMessage(
new HttpMethod("PURGE"),
new Uri("http://www.example.com/image.jpg")))
using (var response = await client.SendAsync(request))
{
// work with response
}