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);