Just add a simple line before you make your download:
string url = ...
string fileName = ...
WebClient wb = new WebClient();
wb.Headers.Add("User-Agent: Other"); //that is the simple line!
wb.DownloadFile(url, fileName);
That’s it.
Related Contents:
- Using CookieContainer with WebClient class
- How to post data to specific URL using WebClient in C#
- Deciding between HttpClient and WebClient
- Login to website, via C#
- Authenticate and request a user’s timeline with Twitter API 1.1 oAuth
- How to change the timeout on a .NET WebClient object
- Set timeout for webClient.DownloadFile()
- Upload and download a file to/from FTP server in C#/.NET
- How do I log into a site with WebClient?
- C# WebClient disable cache
- POSTing JSON to URL via WebClient in C#
- How to get a JSON string from URL?
- WebClient accessing page with credentials
- Characters in string changed after downloading HTML from the internet
- Uncompressing gzip response from WebClient
- Kanji characters from WebClient html different from actual Kanji in website
- HTTP POST Returns Error: 417 “Expectation Failed.”
- What difference is there between WebClient and HTTPWebRequest classes in .NET?
- How can you add a Certificate to WebClient (C#)?
- Download file with WebClient or HttpClient?
- ASP.NET Controller: An asynchronous module or handler completed while an asynchronous operation was still pending
- How to make my web scraper log in to this website via C#
- Is it possible to transfer authentication from Webbrowser to WebRequest
- How do I authenticate a WebClient request?
- Requesting html over https with c# Webclient
- Using WebClient or WebRequest to login to a website and access data
- The notorious yet unaswered issue of downloading a file when windows security is required
- How to get status code from webclient?
- How do I create a directory on FTP server using C#?
- How to ignore a certificate error with c# 2.0 WebClient – without the certificate
- How to fill forms and submit with Webclient in C#
- C# – How to make a HTTP call
- How do I Async download multiple files using webclient, but one at a time?
- Accept Cookies in WebClient?
- JsonConvert.DeserializeObject (string) returns null value for $id property
- C# webclient and proxy server
- WebClient runs javascript
- “A connection attempt failed because the connected party did not properly respond after a period of time” using WebClient
- How to pass data (and references) between scenes in Unity
- Dynamically replace the contents of a C# method?
- Is the C# compiler smart enough to optimize this code?
- Is there an exponent operator in C#?
- IEqualityComparer that uses ReferenceEquals
- Can I split an IEnumerable into two by a boolean criteria without two queries?
- The type initializer for ‘Emgu.CV.CvInvoke’ threw an exception
- JsonConvert.Deserializer indexing issues
- Correct implementation of a custom config section with nested collections?
- what is “public new virtual void Method()” mean?
- Ignore a property during xml serialization but not during deserialization
- Correct way to use HttpContext.Current.User with async await