Is there a way to do a PUT with WebClient?

自古美人都是妖i 提交于 2019-12-03 10:24:21

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.

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...

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

Kibbee

I don't think that WebClient can do it. However, you can use the HttpWebrequest class to perform a put request.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!