.NET Sync GateWay request error with httpclient

Sync gateway version: 2.0.0-823
Couchbase Server version: 5.5.0-2036
Couchbase Lite version: v2.0.0-db023

I try to get the sync gateway database setting by sending a GET request to let’s say http://xxxxxxx:4984/item. It goes perfectly well with Postman, I get a nice 200OK

When I tretry in .NET I get a 401Unauthorized

my code is

using (HttpClient _client = new HttpClient()) {
 HttpResponseMessage response =  await _client.GetAsync(dbInfoUrl);
                            if (response.IsSuccessStatusCode)

even if I try with basic auth in this form:

     _client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", Convert.ToBase64String(

I get the same error… .

What am I doing wrong here?

Since it works w/ Postman and not with your client, its would appear that there is something in construction of the request by the .Net app. At a glance , nothing seems to stand out as being incorrect.
So assuming that the credentials you provided are right, can you use a packet sniffer like wireshark to see the exact packet that is sent to the Sync Gateway . Then you could compare that with the one sent from Postman …Maybe something in the encoding ?

Very weird.

I especially made a console solution to be sure the code works out. Everything works fine on desktop: the console app, postman, fiddler.

The problem is nothing works out on the Xamarin.Android.

Anyway I’ll keep trying

UPDATE: I needed to include the trailing slash in the url.