You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Can't use the http Basic-Authentication the statuscode is always System.Net.HttpStatusCode.Unauthorized.
With the normal MessageHandler the code works.
How to use the http Basic Authentification?
Thanks for your support!
Sample Code:
try
{
var tlsConfig = new TLSConfig()
{
DangerousAcceptAnyServerCertificateValidator = true,
Pins = new List<Pin>()
{
new Pin()
{
Hostname = "*",
PublicKeys=new string[]{ }
}
}
};
var handler = new NativeMessageHandler(false, tlsConfig);
HttpClient client = new HttpClient(handler);
var webdavUrl = new Uri("https://ubuntu/remote.php/dav/files/zpush");
var passwordCache = new CredentialCache();
passwordCache.Add(webdavUrl, "Basic", new NetworkCredential("xxx", "secret"));
handler.Credentials = passwordCache;
handler.UseDefaultCredentials = false;
handler.PreAuthenticate = true;
var request = new HttpRequestMessage(new HttpMethod("PROPFIND"), webdavUrl);
var response = await client.SendAsync(request, HttpCompletionOption.ResponseContentRead).ConfigureAwait(false);
var satuscode = response.StatusCode;
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
}
The text was updated successfully, but these errors were encountered:
Can't use the http Basic-Authentication the statuscode is always System.Net.HttpStatusCode.Unauthorized.
With the normal MessageHandler the code works.
How to use the http Basic Authentification?
Thanks for your support!
Sample Code:
The text was updated successfully, but these errors were encountered: