Top "Dotnet-httpclient" questions

Refers to the System.

Authorization header is lost on redirect

Below is the code that does authentication, generates the Authorization header, and calls the API. Unfortunately, I get a 401 Unauthorized …

c# .net rest dotnet-httpclient
How does one configure HttpClient not to automatically redirect when it receives a 301 HTTP Status Code?

Consider an ASP.NET Web API service that redirects public class ThisController : ApiController { /* more methods */ public override HttpResponseMessage Post() { var …

c#-4.0 asp.net-web-api dotnet-httpclient
HttpClient: The uri string is too long

Given the following attempt to post data to a web service that generates PDF files, PDF rocket (which is awesome …

c# dotnet-httpclient
How do I set a response cookie on HttpReponseMessage?

I would like to create a demo login service in web api and need to set a cookie on the …

asp.net-web-api dotnet-httpclient
Should I await ReadAsStringAsync() if I awaited the response that I'm performing ReadAsStringAsync() on?

Should I await ReadAsStringAsync() if I awaited the response on which I'm performing ReadAsStringAsync()? To clarify further, what is the …

c# async-await dotnet-httpclient
How to read cookies from HttpResponseMessage?

This is my recent code: HttpClient authClient = new HttpClient(); authClient.BaseAddress = new Uri("http://localhost:4999/test_db/_session"); authClient.DefaultRequestHeaders.…

c# cookies asp.net-web-api dotnet-httpclient
Cause of Error CS0161: not all code paths return a value

I've made a basic extension method to add retry functionality to my HttpClient.PostAsync: public static async Task<HttpResponseMessage&…

c# .net dotnet-httpclient
HttpClient crawling results in memory leak

I am working on a WebCrawler implementation but am facing a strange memory leak in ASP.NET Web API's HttpClient. …

c# memory-leaks asp.net-web-api dotnet-httpclient
How to pass in a mocked HttpClient in a .NET test?

I have a service which uses Microsoft.Net.Http to retrieve some Json data. Great! Of course, I don't want …

c# .net mocking dotnet-httpclient microsoft-fakes
HttpClient with BaseAddress

I have a problem calling a webHttpBinding WCF end point using HttpClient and the BaseAddress property. HttpClient I created a …

c# .net wcf dotnet-httpclient webhttpbinding