I am trying to call a webapi from C#, the webapi is hosted in IIS and requires login when you access it.
I don't know how to call the webapi with current login credential, and if I don't pass anything, the result will be the HTML for the login page.
using (var httpClient = new HttpClient())
{
var response = httpClient.GetAsync("url").Result;
var result = response.Content.ReadAsStringAsync().Result;
}
I remember there is a way to pass in the current login credential, but i can't seem to find it.