I have a requirement where, i need to send a body on a GET request, the .netFramework 4.7.2, throw an Protocol exception, but as far i read, is possible to send it using a WinHttpHandler
, but I'm getting a
Error 12175 calling WINHTTP_CALLBACK_STATUS_REQUEST_ERROR, 'A security error occurred
im setting the handler protocols and certification callback, but im on a dead end.
WinHttpHandler handler = new WinHttpHandler();
handler.ServerCertificateValidationCallback = (senderX, certificate, chain, sslPolicyErrors) => { return true; };
handler.SslProtocols = SslProtocols.Tls12 | SslProtocols.Tls11 | SslProtocols.Tls;
HttpClient client = new HttpClient(handler);
var requestSELF = new HttpRequestMessage(HttpMethod.Get, "https://ABC/XYX");
requestSELF.Headers.Add("HEADER1", "ABC");
requestSELF.Headers.Add("HEADER2", "ABC");
var content = new StringContent(JsonUtils.ConvertToJson(body), null, "application/json");
requestSELF.Content = content;
var responseHARD = client.SendAsync(requestSELF).Result;
I'm unable to change the fact that the client set a body on a get verb, is what i what got to work with, but i cant find a happy solution, my alternative is to make a JS file and get result from it, but it broke the project standards.