Encoding exception.Registerprovider with Restsharp

Asked

Viewed 78 times

1

Hello! I am getting an exception in "mscorlib.dll" when using Restsharp to every request made to the API.

Exception thrown: 'System.Argumentexception' in mscorlib.dll ("'' is not a valid encoding name. For information on how define a custom encoding, see the documentation of Encoding method.Registerprovider.") Hyperlink: Activate Historical Debugging 8.30s [19772] Main Thread

This is shown in Visualstudio’s "Output". But nothing abnormal occurs in the application. All methods (get, post, put etc) work perfectly.

Follow my request...

var restClient = new RestClient($"{Secao.ApiBaseUrl}/login");
        var restRequest = new RestRequest(Method.POST);
        restRequest.AddHeader("cache-control", "no-cache");
        restRequest.AddHeader("Content-Type", "application/x-www-form-urlencoded");
        restRequest.RequestFormat = DataFormat.Json;
        restRequest.AddParameter("Email", Usuario, ParameterType.GetOrPost);
        restRequest.AddParameter("Senha", Senha, ParameterType.GetOrPost);
        var responseLogin = restClient.Execute(restRequest);

I found nothing related on the internet, except the generic documentation of the citizen method that is (in my opinion) vague.

I count on the help of the community. Grateful!

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.