How do I set a default User Agent on an HttpClient?
You can solve this easily using:
HttpClient _client = new HttpClient();
_client.DefaultRequestHeaders.Add("User-Agent", "C# App");
Using DefaultRequestHeaders.Add(...)
did not work for me.
var httpClient = new HttpClient();
httpClient.DefaultRequestHeaders.UserAgent.ParseAdd("Mozilla/5.0 (compatible; AcmeInc/1.0)");