Home » Education » Using HttpClient in .NET Core to Connect to APIs in C#

Using HttpClient in .NET Core to Connect to APIs in C#

Written By IAmTimCorey on Wednesday, May 27, 2020 | 08:00 AM

 
How do you safely connect to APIs in .NET Core using C#? HttpClient is the way to go, but doing right is important. Otherwise, you could exhaust your connection pool and cause issues in your application. Source Code: https://www.DevForge.com/downloads/?code=HttpClient Mailing List: https://signup.iamtimcorey.com/ Purchase Courses: https://www.DevForge.com 0:00 - Intro 0:56 - Blazor server demo app 2:27 - Add Htpp Client service in startup.cs 3:36 - Http.Json NuGet reference 4:48 - New Blazor page: Razor component 5:55 - Data models from json data 14:15 - Editing Blazor page: Page name and navigation link 16:16 - Inject and use Http client: long way 26:40 - Editing Blazor page: Blazor page render logic 31:19 - Running Demo App 33:22 - Inject and use Http client with try - catch 36:29 - Http client with base url from appsettings.json 43:02 - Summary and concluding remarks Thanks to Ralfs HBK for the chapter breakdown