I cannot change user agent of HttpWebRequest:
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri);
request.Headers[HttpRequestHeader.UserAgent] = "test";
Always throw exception. Someone have idea how solve this?
You need to use request.UserAgent property to set the user agent.
https://msdn.microsoft.com/en-us/library/system.net.httpwebrequest.useragent(v=vs.100).aspx
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.