HttpClientHandler hand = new HttpClientHandler();
ProgressMessageHandler processMessageHander = new ProgressMessageHandler(hand);
HttpClient localHttpClient = new HttpClient(processMessageHander);
HttpRequestMessage httpRequestMessage = new HttpRequestMessage();
httpRequestMessage.Method = HttpMethod.Put;
httpRequestMessage.Content = new StreamContent(content);
//for upload
processMessageHander.HttpSendProgress += (sender, e) =>
{
int num = e.ProgressPercentage; //you can use HttpProgressEventArgs e
};
//for download
// processMessageHander.HttpReceiveProgress += (sender, e) =>
// {
// int num = e.ProgressPercentage;
// };
HttpResponseMessage test = await localHttpClient.SendAsync(httpRequestMessage);
标签:HttpWebChilent,进度条,int,httpRequestMessage,new,上传,HttpRequestMessage,processMessa From: https://www.cnblogs.com/LCLBook/p/18074945