Is there a way to do a PUT with WebClient?

Huh? As stated on MS's website WebClient.UploadData does take the method (as a string) too right? Or am I missing something?


There are overloads for UploadString that let you specify the method. For example, this one takes a Uri, a string for the method, and a string for the data.

using (var webClient = new WebClient())
{
    webClient.UploadString(apiUrl, 
        WebRequestMethods.Http.Put, // or simply use "PUT"
        JsonConvert.SerializeObject(payload))
}

You can use webclient.UploadString(urlwithparams,"Put","")

url with params should include the params in querystring format ... urlwithparams = www.foo.com?key=value&key2=value2

This worked for me...