有没有办法做的WebClient一个PUT?没有办法、WebClient、PUT

2023-09-07 14:50:57 作者:失恋算个叼

在.NET 4.0 WebClient类,是有没有办法做一个PUT?

with the WebClient class in .NET 4.0, is there a way to do a PUT?

我知道你可以做DownloadString()和UploadString()一个POST一个GET,但有一个方法或属性,让你做一个PUT?

I know you can do a GET with DownloadString() and a POST with UploadString(), but is there a method or property that lets you do a PUT?

感谢。

推荐答案

有重载 UploadString 让您指定的方法。例如,这个需要一个乌里,一个字符串的方法,以及字符串的数据。

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.