开发者

Sending HTTPS request from DLL in C#

I really have no idea about the issue here. I have a DLL to send requests to an HTTPS server and get response with below C# code

ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
HttpClient client = new HttpClient();
HttpResponseMessage response = await client.GetAsync(url);
response.EnsureSuccessStatusCode();
string result = await response.Content.ReadAsStringAsync();

The DLL is with a standard interface. If this is called from my C# application, I got an error when read string fr开发者_开发技巧om the response, sayiny "input string was not in a correct format". But if the URL is HTTP (not HTTPS) or it is called from a standard commercial application, it works. Any help here is highly appreciated.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜