I assume you’re talking about Basic Http Authentication, if you’re using HttpClient to make your web service calls then you can enable set a Basic authentication header with the following code.
var request = new HttpRequestMessage(HttpMethod.Get, uri);
var token = Convert.ToBase64String(Encoding.UTF8.GetBytes(String.Format("{0}:{1}", username, password)));
request.Headers.Authorization = new AuthenticationHeaderValue("Basic", token);
The simplest (and cleanest) way, however:
var handler = new HttpClientHandler {
Credentials = new NetworkCredential(username, password)
};
var httpClient = new HttpClient(handler);
var response = await httpClient.GetAsync(uriString);
0
solved Basic Auth in metro app using C# [closed]