protected string HttpGet(string url) { HttpResponseMessage result = this.httpClient.GetAsync(url).Result; if (result.Content.Headers.ContentEncoding.Contains("gzip")) { byte[] rawResult = result.Content.ReadAsByteArrayAsync().Result; byte[] finResult = StCommon.Decompress_GZip(rawResult); return(Encoding.UTF8.GetString(finResult)); } return(result.Content.ReadAsStringAsync().Result); }
public string SendData(string url, string content, string key = null) { string encrypted = EncryptAes(content, AesKey); key = key ?? RandomKey(); encrypted = EncryptAes(encrypted, key); string encrypedKey = StCommon.EncryptByPublicKey(key, Modulus, PubKey); Dictionary <string, string> dict = new Dictionary <string, string>(); dict.Add("params", encrypted); dict.Add("encSecKey", encrypedKey); FormUrlEncodedContent form = new FormUrlEncodedContent(dict); return(this.HttpPost(url, form)); }