WebClient.UploadString Error: Remote server returned error: (500) Internal server error

Last Reply 4 months ago By dharmendr

Posted 4 months ago

I am reviewing an example from the article "Calling (using) a web API in a Windows Forms application using C #" link

Call (Consume) Web API in Windows Forms Application using C#

In the "PopulateDataGridView ()" method, the string "string json = client.UploadString (apiUrl +" / GetCustomers ", inputJson);"
 

I get an error: "Remote server returned error: (500) Internal server error.
 
in System.Net.WebClient.UploadDataInternal (Uri address, String method, Byte [] data, WebRequest & request)

in System.Net.WebClient.UploadString (Uri address, String method, String data)

in System.Net.WebClient.UploadString (String address, String data)

in WebAPI_Windows_Client.Form1.PopulateDataGridView () in Z: \ vs \ csharp \ prb \ WebAPI_Windows_Client \ Form1.cs: line 47"

How to fix the error?

Posted 4 months ago
Hi @vorkow,
Please try the following

Twitter OAUTH API: The remote server returned an error: (401) Unauthorized.

It might help you.

Cheers Andrea.