How to set User-Agent in WebClient
问题 I used the code below to open a stream request to a youtube video, but it always return an exception "The remote server returned an error: NotFound". Then I tried to use Fiddler to detect the problem, and I saw that the WebClient auto set User-Agent field to NativeHost, not my User-Agent as below. My code to send a request to youtube: private static Task<string> HttpGet(string uri) { var task = new TaskCompletionSource<string>(); var web = new WebClient(); web.OpenReadCompleted += (sender,