public static string HttpGet(string Url, string header = "", string senddata = "") { //byte[] dataArray = System.Text.Encoding.UTF8.GetBytes(senddata); // Console.Write(Encoding.UTF8.GetString(dataArray)); System.Net.HttpWebRequest request = (System.Net.HttpWebRequest)System.Net.WebRequest.Create(Url); request.Method = "get"; request.ContentType = "application/json"; if (!string.IsNullOrEmpty(header)) { request.Headers.Add("Authorization", header); } //request.ContentLength = dataArray.Length; //request.CookieContainer = cookie; if (!string.IsNullOrEmpty(senddata)) { var type = request.GetType(); var currentMethod = type.GetProperty("CurrentMethod", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(request,null); var methodType = currentMethod.GetType(); methodType.GetField("ContentBodyNotAllowed", BindingFlags.NonPublic | BindingFlags.Instance).SetValue(currentMethod, false); using (var streamWriter = new StreamWriter(request.GetRequestStream())) { streamWriter.Write(senddata); } } try { System.Net.HttpWebResponse response = (System.Net.HttpWebResponse)request.GetResponse(); System.IO.StreamReader reader = new System.IO.StreamReader(response.GetResponseStream(), System.Text.Encoding.UTF8); String res = reader.ReadToEnd(); reader.Close(); return res.ToString(); } catch (Exception e) { return e.Message + e.ToString(); } }