当前位置:编程学习 > C#/ASP.NET >>

获取验证码图片

http://bbs.xiaomi.cn/thread-5488240-1-1.html

我想获取小米论坛的验证码图片,有什么办法

用C#解决 --------------------编程问答--------------------  楼主仔细查阅下  httpWebRequest 与 httpWebResponse

这样,我的方法给你贴出来 


public Stream GetStream()
        {
            
            HttpWebResponse httpWebResponse = null;
            HttpWebRequest httpWebRequest;

            httpWebRequest.Method = Method;
            httpWebRequest.Accept = "image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*";
            httpWebRequest.Headers["Accept-Charset"] = "GBK,utf-8;q=0.7,*;q=0.3";
            httpWebRequest.Headers["Accept-Language"] = "zh-CN,zh;q=0.8";
            httpWebRequest.Headers["Cache-Control"] = "max-age=0";
            httpWebRequest.ContentType = "application/x-www-form-urlencoded";




            httpWebRequest.CookieContainer = cookie;

            httpWebRequest.Referer = Url;
            httpWebRequest.UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.56 Safari/536.5";
            httpWebRequest.Proxy = null;
            httpWebRequest.AllowAutoRedirect = true;


            httpWebRequest.Timeout = 10000;


            httpWebResponse = (HttpWebResponse)httpWebRequest.GetResponse();


            return httpWebResponse.GetResponseStream();
            

        }


this.pictureBox1.Image = GetStream();
--------------------编程问答-------------------- 还有什么办法么 --------------------编程问答-------------------- 办法很多,我给你的例子是最好最实用的。 --------------------编程问答-------------------- 直接使用WebClient类的DownLoadFile --------------------编程问答--------------------   有详细点的吗? 
补充:.NET技术 ,  其他语言
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,