string base64EncodedAuthorizationString ="username" + ":" + "password"; byte[] binaryData = new Byte[base64EncodedAuthorizationString.Length]; binaryData = Encoding.UTF8.GetBytes(base64EncodedAuthorizationString); base64EncodedAuthorizationString = Convert.ToBase64String(binaryData); base64EncodedAuthorizationString = "Basic " + base64EncodedAuthorizationString; req.Headers.Set("Authorization", base64EncodedAuthorizationString); req.PreAuthenticate = true; req.Credentials = new NetworkCredential(txtUser.Text, txtPassword.Text);
Powered by: 博客园 Copyright © 2024 烈火123 Powered by .NET 8.0 on Kubernetes