I am trying to handle a response from an api, i keep getting a TLSException, and can't find any relevant informaton on this exception online.
I am posting a username and password to the server succesfully, but the exception occurs while trying to deserialize the response.
The response consists of 2 strings, and i made a class called Response, matching this. This is how i handle the response
public async Task<Response> PostResponse<Response>(string weburl,
FormUrlEncodedContent content)
{
var response = await client.PostAsync(weburl, content);
var jsonResult = response.Content.ReadAsStringAsync().Result;
var responseObject = JsonConvert.DeserializeObject<Response>
(jsonResult);
return responseObject;
}
I followed a somewhat similar post and tried the code:
ServicePointManager.ServerCertificateValidationCallback += (sender, cert, chain, sslPolicyErrors) => true;
I dont know if this is solving my problem as this arises a new exception:
Cannot Convert System.Func[SystemObject, SystemSecurity]