You can solve this easily using:
HttpClient _client = new HttpClient();
_client.DefaultRequestHeaders.Add("User-Agent", "C# App");
More Related Contents:
- Calling async method synchronously
- Download/Stream file from URL – asp.net
- Could not find a part of the path … bin\roslyn\csc.exe
- How to get current user, and how to use User class in MVC5?
- CryptographicException: Padding is invalid and cannot be removed and Validation of viewstate MAC failed
- asp.net: Invalid postback or callback argument
- Printing to a client printer from a web app
- Passing array of strings to webmethod with variable number of arguments using jQuery AJAX
- ViewModel validation for a List
- Getting relative virtual path from physical path
- How to get full host name + port number in Application_Start of Global.aspx?
- Should I use byte or int?
- What is the best approach to handle session timeouts in asp.net
- How to make LINQ execute a (SQL) LIKE range search
- How to debug a single thread in Visual Studio?
- How can I get date and time formats based on Culture Info?
- ConfigurationManager.AppSettings getting null?
- MEF with MVC 4 or 5 – Pluggable Architecture (2014)
- ThreadStaticAttribute in ASP.NET
- Registering an Application to a URI Scheme in windows 10
- How do you post a JSON file to an ASP.NET MVC Action?
- System.web.mvc missing
- How to route EVERYTHING other than Web API to /index.html
- Document.Ready() is not working after PostBack
- How can I ensure that appsettings.dev.json gets copied to the output folder?
- How to add config transformations for a custom config file in Visual Studio?
- Sort two Lists together as one?
- The ‘Microsoft.ACE.OLEDB.12.0’ provider is not registered on the local machine.
- JavaScript: Alert.Show(message) From ASP.NET Code-behind
- Getting system Timezones in different languages