Posting a JSON string to server using a proxy
var httpClientHandler = new HttpClientHandler { Proxy = new WebProxy("http://localhost:8888", false), UseProxy = true }; using (var client = new HttpClient(httpClientHandler)) { string apiUrl = "http://yourserver.com/postpage"; StringContent content = new System.Net.Http.StringContent("{dataelem:value}", Encoding.UTF8, "application/json"); HttpResponseMessage response = client.PostAsync(apiUrl, content).Result; }
2 comments:
Hello! thanks for share it! it helped to me.
Thank you. This helped me as well.
Post a Comment