| [C#] 纯文本查看 复制代码  private void button1_Click(object sender, EventArgs e)
        {
            HttpHelper http = new HttpHelper();
            HttpItem item = new HttpItem()
            {
                URL = "http://mail.hainan.net/webmailhainan/tianyaValidateCode.jsp",//URL     必需项    
                Encoding = System.Text.Encoding.GetEncoding("utf-8"),//URL     可选项 默认为Get   
                Method = "get",//URL     可选项 默认为Get   
                Referer = "http://mail.hainan.net/webmailhainan/register.jsp",//来源URL     可选项   
                Allowautoredirect = false,//是否根据301跳转     可选项    
                ProxyIp = "",//代理服务器ID     可选项 不需要代理 时可以不设置这三个参数    
            };
            HttpResult result = http.GetHtml(item);
            item = new HttpItem()
           {
               URL = result.Header["Location"].Trim(),//URL     必需项    
               Encoding = System.Text.Encoding.GetEncoding("utf-8"),//URL     可选项 默认为Get   
               Method = "get",//URL     可选项 默认为Get   
               Referer = "http://mail.hainan.net/webmailhainan/register.jsp",//来源URL     可选项   
               Allowautoredirect = false,//是否根据301跳转     可选项   
               ResultType = ResultType.Byte,
               Cookie = result.Cookie
           };
            result = http.GetHtml(item);
            pictureBox1.Image = byteArrayToImage(result.ResultByte);
        }
        /// <summary>
        /// 字节数组生成图片
        /// </summary>
        /// <param name="Bytes">字节数组</param>
        /// <returns>图片</returns>
        private Image byteArrayToImage(byte[] Bytes)
        {
            MemoryStream ms = new MemoryStream(Bytes);
            Image outputImg = Image.FromStream(ms);
            return outputImg;
        }分开取的可以了现在
 
 |