public string httpclient(string Url, HttpMethod httpmethod)
{
try
{
//跳过ssl错误
HttpClientHandler clientHandler = new HttpClientHandler();
clientHandler.ServerCertificateCustomValidationCallback = (sender, cert, chain, sslPolicyErrors) => { return true; };
HttpClient client = new HttpClient(clientHandler);
var request = new HttpRequestMessage
{
Method = httpmethod,
RequestUri = new(Url, UriKind.Absolute)
};
request.Headers.Add("Authorization", "bearer " + "afd8ab48-d351-45b3-a6d1-6f7c0b395da3");
var gettoken_Response = client.Send(request);
Task<string> cc = gettoken_Response.Content.ReadAsStringAsync();
return cc.Result;
}
catch (Exception ex)
{
throw;
}
return null;
}