internal void do_request() { if (client != null) { try { if (post_data == null) { this.response = client.GetAsync(new Uri(this.requrl, true)).Result; } else { Dictionary <string, string> val = new Dictionary <string, string>(); val[Encoding.UTF8.GetString(post_data)] = ""; var cc = new FormUrlEncodedContent(val); this.response = client.PostAsync(new Uri(this.requrl, true), cc).Result; } this.response.EnsureSuccessStatusCode(); this.content = this.response.Content.ReadAsByteArrayAsync().Result; this.client = null; this.client_handler = null; } catch (Exception exception) { this.serror = exception.Message + "\r\n" + exception.StackTrace + "\r\n"; } } }
public void Dispose() { content = null; post_data = null; response = null; client = null; client_handler = null; GC.SuppressFinalize(this); }
private void InitWWW(string surl, byte[] postData, Hashtable iHeaders, string cookie) { this.requrl = surl; if (client == null) { client_handler = new ShipHttpClientHandler(); client_handler.CookieContainer = new System.Net.CookieContainer(); if (cookie != null && cookie != "") { string k = cookie.Substring(0, 7); string v = cookie.Substring(8); client_handler.CookieContainer.Add(new Uri(surl), new System.Net.Cookie(k, v, "/")); } client_handler.UseCookies = true; client = new HttpClient(client_handler); } }
private void InitWWW(string surl, byte[] postData, Hashtable iHeaders, string cookie) { this.requrl = surl; post_data = postData; if (client == null) { client_handler = new ShipHttpClientHandler(); client_handler.CookieContainer = new System.Net.CookieContainer(); if (cookie != null && cookie != "") { string k = cookie.Substring(0, 7); string v = cookie.Substring(8); client_handler.CookieContainer.Add(new Uri(surl), new System.Net.Cookie(k, v, "/")); } client_handler.UseCookies = true; client = new HttpClient(client_handler); } }
internal void do_request() { if (client != null) { try { if(post_data == null) { this.response = client.GetAsync(new Uri(this.requrl, true)).Result; } else { Dictionary<string, string> val = new Dictionary<string, string>(); val[Encoding.UTF8.GetString(post_data)] = ""; var cc = new FormUrlEncodedContent( val); this.response = client.PostAsync(new Uri(this.requrl, true), cc).Result; } this.response.EnsureSuccessStatusCode(); this.content = this.response.Content.ReadAsByteArrayAsync().Result; this.client = null; this.client_handler = null; } catch (Exception exception) { this.serror = exception.Message +"\r\n" + exception.StackTrace + "\r\n"; } } }