core
core copied to clipboard
WebClient like API using HttpClient
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
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.
@scalablecory can you follow up?
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.
This issue should probably be moved to https://github.com/dotnet/runtime.