コード例 #1
0
        public bool AutoLogout()
        {
            HttpResult result = new HttpResult();

            try
            {
                var item = new HttpItem()
                {
                    URL         = "http://www.qichacha.com/user_logout",
                    Method      = "get",       //URL     可选项 默认为Get
                    ContentType = "text/html", //返回类型    可选项有默认值
                    //Timeout = Settings.Timeout,
                    Cookie = curCookie
                };


                SimpleCrawler.HttpHelper http = new SimpleCrawler.HttpHelper();
                result = http.GetHtml(item);
            }
            catch (WebException ex)
            {
            }
            catch (TimeoutException ex)
            {
            }
            catch (Exception ex)
            {
            }


            if (result.StatusCode == HttpStatusCode.OK)
            {
                // ShowMessageInfo("退出成功");
                // this.webBrowser.Navigate(addCredsToUri(this.textBox.Text));
                return(true);
            }
            else
            {
                // ShowMessageInfo("退出失败");
                return(false);
            }
        }