I’m currently using HttpWebRequest to get a website. I’d like to use the await pattern, which is not given for HttpWebRequests. I found the class HttpClient, which seems to be the new Http worker class. I’m using HttpClient.GetAsync(...) to query my webpage. But I’m missing the option to add ClientCredentials like HttpWebRequest.Credentials. Is there any way to give the HttpClient authentication information?
I’m currently using HttpWebRequest to get a website. I’d like to use the await
Share
You can pass an instance of the HttpClientHandler Class with the credentials to the HttpClient Constructor: