[HOWTO] Set Cookie Header on DefaultRequestHeaders of HttpClient

For one of our customers we had to implement Cookie handling for authentication purposes. This means reading the session token out of the Set-Cookie header and send the session token in the Cookie header of every request. When using the HttpClient from System.Net.Http there are two possibilites to do that. Either by passing a HttpClientHandler […]

HttpClient and how to use Headers, Content-Type and PostAsync

As you might have already heard and tried out with .NET 4.5 (or so) Microsoft blessed us with a new and shiny HttpClient that should be easier to use, support async programming and (that’s best) finally allow the user to set any headers without reverting to some workaround code (cf. WebClient and its underlying classes). […]