How to set User Agent with System.Net.WebRequest in c#
问题 Hi I'm trying to set User Agent with WebRequest, but unfortunately I've only found how to do it using HttpWebRequest, so here is my code and I hope you can help me to set the User Agent using WebRequest. here is my code public string Post(string url, string Post, string Header, string Value) { string str_ReturnValue = ""; WebRequest request = WebRequest.Create(url); request.Method = "POST"; request.ContentType = "application/json;charset=UTF-8"; request.Timeout = 1000000; if (Header != null &