网页上的验证码想让它显示在form窗体上pictruebox上面!
baidu,google,搜了也不少..就是没找到合适的.大家给点思路..

解决方案 »

  1.   

    给你个源代码,
    private Image GetCodeImage(string path)
            {
                HttpWebRequest request = WebRequest.Create(string.Format("{0}{1}", URI, path)) as HttpWebRequest;
                HttpWebResponse response = null;
                Stream stream = null;
                Image result = null;            request.Method = "GET";
                request.Referer = string.Format("{0}main.aspx", URI);
                request.UserAgent = "MSIE 6.0";
                request.CookieContainer = cookie;            try
                {
                    response = request.GetResponse() as HttpWebResponse;
                    stream = response.GetResponseStream();
                    cookie.Add(response.Cookies);
                    result = Image.FromStream(stream);
                    stream.Close();
                }
                catch (Exception e) { throw new Exception(e.Message + "," + e.TargetSite + "," + e.InnerException); }
                finally
                {
                    if (response != null) response.Close();
                }
                return result;
            }
      

  2.   

    简单的,用webbroswer+ HTML
    复杂的,有httpRequest+Cookie
      

  3.   

    httpRequest+Cookie还没用过..
    去搜搜资料去
      

  4.   


    用这种方法,最好先下载个抓包程序,用来看看IE和Server之间数据交换的格式和cookie/session之间的传值过程.然后直接调用验证码的URL,并把cookie值传过去,拿到图片.
      

  5.   

     System.Net.WebClient.DownloadData(验证码图片网址)返回一个byte[]
    用这个byte[]构建一个MemoryStream
    用Image.FromStream载入这个MemoryStream
    设置PictureBox.Image=这个img就是了