Shomaail
Shomaail

Reputation: 493

UploadString of Webclient for using PUT method

I want to Update data using webclient UploadString method. The following code gives error saying,

The remote server returned an error: (405) Method Not Allowed.

var syncClient = new WebClient();
string URI = "https://test-khalid.herokuapp.com/v1/roles/de988992-4db8-4f75-884b-3dba893310e6";
syncClient.Headers.Add("authorization", "invalid-token");
Response.Write(syncClient.UploadString(URI, "PUT", "{\"title\":\"Shomaail Title 1\", \"role_type\":\"3\" }"));

I wrote the above code following this. Please let me know the answer?

Upvotes: -1

Views: 1417

Answers (1)

Shomaail
Shomaail

Reputation: 493

Problem is solved using PATCH command instead of PUT. In the server PATCH is specified for update not PUT

Upvotes: 0

Related Questions