Here I'm going to post whatever that is interesting for me. All things about programming using JavaScript and ASP.NET Core. And something else.

A blog about ASP.Net Core and JavaScript

Tagged with upload

Couple a days ago I was looking for some information about image uploading from external URL in an ASP.NET Core application. I‘ve found a great post written by Igor Sikorsky (see Sources [1]) and another one, which was written by Andrew Lock (see Sources [2]) who used the same approach.

But in Igor’s post discussion, someone noticed improper using of HttpClient to retrieve the image from external URL. Few seconds googling helped to find another interesting post by Simon Timms [3] which shows how to use HttpClient correctly. He suggests declaring a static instance of HttpClient in the .NET Core application main class.

It is cool, but what if I do not want to use HttpClient as a property of the main app class. What if I want to get it from DI service?

If you are interested in this approach too, welcome to read more…