It’s easy to set a user agent on an HttpRequest, but often I want to use a single HttpClient and use the same user agent every time, rather than having to set it on each request.
You can solve this easily using:
HttpClient _client = new HttpClient(); _client.DefaultRequestHeaders.Add("User-Agent", "C# App");
Answered By – Tom Warner
Answer Checked By – Cary Denson (BugsFixing Admin)