Legal Notice
The opinions expressed herein are my own personal opinions and do not represent my employer’s view in anyway.Top Posts
- C# HttpClient POST or PUT Json with content type application/json
- Using C# HttpClient from Sync and Async code
- C# Get expiry timestamp from JWT token
- C# Using Newtonsoft and dynamic ExpandoObject to convert one Json to another
- ASP.Net Core API - "'s' is an invalid start of a value. Path: $ | LineNumber: 0 | BytePositionInLine: 0."
- Command line parameters in .NET Core Console Applications
- Read blob file from Microsoft Azure Storage with .NET Core
Archive
Meta
Tag Archives: HttpClient
HttpClient retry on HTTP timeout with Polly and IHttpClientBuilder
The Polly retry library and the IHttpClientBuilder is a match made in heaven as it defines all the retry logic at startup. The actual HttpClient calls are therefore untouched by any retry code. The retry logic is called policies, and … Continue reading
Posted in .net, .NET Core, c#
Tagged HttpClient, IHttpClientBuilder, IHttpClientFactory, Polly
Leave a comment
Add a UserAgent to the IHttpClientFactory in .NET Core
Using a IHttpClientFactory to create HttpClient connections have a number of advantages, as you can configure several httpclients on startup. Each client will be reused, including the properties attached to that client. In a previous post I showed how to … Continue reading
HttpClient retry mechanism with .NET Core, Polly and IHttpClientFactory
A lot of HttpClient errors are temporary and is caused by server overload, temporary nerwork timeouts and generic gliches in the Matrix. These scenarios can be dealt with using a retry pattern. In .NET Core, the most common retry library … Continue reading
C# HttpClient POST or PUT Json with content type application/json
The HttpClient is a nifty tool for getting and sending data to a URL, but it works differently from the old fashioned WebRequest class. The content type is added to the post data instead of added as a header parameter. … Continue reading
Posted in .net, .NET Core, c#, General .NET
Tagged HttpClient, JSON, Newtonsoft, StringContent
1 Comment
Using C# HttpClient from Sync and Async code
The .NEt 4.5 C# System.Net.Http.HttpClient() is a very nice http client implementation, but can be tricky to use if you (like me) are not a trained asynchronous programming coder. So here is a quick cheat sheet on how to work … Continue reading