core icon indicating copy to clipboard operation
core copied to clipboard

WebClient like API using HttpClient

Open ChristianKernDev opened this issue 4 years ago • 4 comments

WebClient like API for HttpClient

As WebClient is an obsolete API (as far as I got told) and has some problems (i.e. automatic redirecting) it would be nice to have a similar replacement API using the HttpClient

Problem

So, a few people have told me, that the WebClient API is marked as obsolete and the HttpClient should be used instead. The problem is that creating an asynchronous download with progress reports, and other very helpful stuff, is very easy with WebClient, but some messy code with HttpClient.

For this reason, most people will use the WebClient API and encounter the same problems over and over again.

Solution

There are two possible solutions:

  • Fix the WebClient API
  • Implement a similar API with similar functionalities but based on the HttpClient

ChristianKernDev avatar Aug 09 '20 23:08 ChristianKernDev

Webclient would be fix just for Progress report? which as already solution like ProgressMessageHandler and where you may thinks about using websocket or split into chunck.

GeraudFabien avatar Aug 14 '20 11:08 GeraudFabien

@scalablecory can you follow up?

carlossanlop avatar Nov 25 '20 23:11 carlossanlop

I agree that progress report would be really useful. It's currently really hard, and you have to implement everything yourself, including a custom stream copy with progress. ProgressMessageHandler seems like something from the old ASP.NET and is not available in .NET Core.

Neme12 avatar Mar 31 '24 04:03 Neme12

This issue should probably be moved to https://github.com/dotnet/runtime.

Neme12 avatar Mar 31 '24 04:03 Neme12