Hi,@zequion. Welcome to Microsoft Q&A.
When ReadAsStringAsync and ReadAsByteArrayAsync tasks are cancelled, the behavior of the remote operation depends on the specific implementation and context. Typically, canceling a task causes the operation to stop as quickly as possible, but this does not always mean that the remote operation terminates immediately.
In some cases, canceling a task may cause the local operation to stop, but the remote server may have already started processing the request and continue to execute. To ensure that the remote operation can also be cancelled, it is usually necessary to include a cancellation token (such as a CancellationToken) in the request, and the remote server needs to support cancellation.
In addition, HttpContent.ReadAsByteArrayAsync() and HttpContent.ReadAsStringAsync() can pass a Cancellationtoken parameter. Here are the official documents for the two methods:
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.