Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void BasicAuthenticationTest()
- {
- string username = Convert.ToBase64String(Encoding.UTF8.GetBytes("joydip"));
- string password = Convert.ToBase64String(Encoding.UTF8.GetBytes("joydip123"));
- HttpClient client = new HttpClient();
- client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Authorization", username + ":" + password);
- var result = client.GetAsync(new Uri("http://localhost/IDG/api/default/")).Result;
- Assert.IsTrue(result.IsSuccessStatusCode);
- }
Add Comment
Please, Sign In to add comment