Пример #1
0
        private static void callback_1(object state)
        {
            try
            {
                Dictionary <string, object> dict = (Dictionary <string, object>)state;
                EasyNeter easy_neter             = new EasyNeter();
                object    oform;
                object    ourl;
                dict.TryGetValue("target", out oform);
                dict.TryGetValue("url", out ourl);
                Form1  form = (Form1)oform;
                string url  = (string)ourl;

                HttpWebResponse response = easy_neter.getHttp(url);
                form.sharedResponse = response;

                /*
                 * form.statusBar1.Text = "URL: " + url;
                 * HttpWebResponse response = easy_neter.getHttp(url);//.CreateGetHttpResponse(tagUrl, null, null, cookies);
                 * form.textBox1.Text = "Http Status Code = " + response.StatusCode;
                 * StreamReader sr = new StreamReader(response.GetResponseStream());
                 * String content = sr.ReadToEnd();
                 * form.label2.Text = content;
                 */
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message);
                MessageBox.Show(e.StackTrace.ToString());
            }
        }
Пример #2
0
        // 实质工作的 方法体
        private void GetMac()
        {
            string          userName   = "******";
            string          tagUrl     = "https://freedom.everstray.com/";
            EasyNeter       easy_neter = new EasyNeter();
            HttpWebResponse response   = easy_neter.getHttp(tagUrl);

            this.textBox1.Text = "Http Status Code = " + response.StatusCode;
            StreamReader sr      = new StreamReader(response.GetResponseStream());
            String       content = sr.ReadToEnd();

            this.label2.Text = content;
        }
Пример #3
0
        private void menuItem4_Click(object sender, EventArgs e)
        {
            string    userName   = "******";
            string    tagUrl     = "https://freedom.everstray.com/";
            EasyNeter easy_neter = new EasyNeter();
            //CookieCollection cookies = new CookieCollection();//如何从response.Headers["Set-Cookie"];中获取并设置CookieCollection的代码略
            HttpWebResponse response = easy_neter.getHttp(tagUrl);//.CreateGetHttpResponse(tagUrl, null, null, cookies);

            this.textBox1.Text = "Http Status Code = " + response.StatusCode;
            StreamReader sr      = new StreamReader(response.GetResponseStream());
            String       content = sr.ReadToEnd();

            this.label2.Text = content;
        }
Пример #4
0
        private void menuItem5_Click(object sender, EventArgs e)
        {
            string tagUrl = "http://sinri.tk/StringLDJudge";
            Dictionary <string, string> parameters = new Dictionary <string, string>();

            parameters.Add("str1", "apple");
            parameters.Add("str2", "pear");
            EasyNeter       easy_neter = new EasyNeter();
            HttpWebResponse response   = easy_neter.postHttp(tagUrl, parameters, 30, null, Encoding.UTF8);

            this.textBox1.Text = "Http Status Code = " + response.StatusCode;
            StreamReader sr      = new StreamReader(response.GetResponseStream());
            String       content = sr.ReadToEnd();

            this.label2.Text = content;
        }