怎么样在.NET中用winform实现站点的登陆并获取登陆后的页面信息?有验证码的.

解决方案 »

  1.   

    用System.Net.WebRequest模拟网页登录.返回一个System.Net.WebResponse.有验证码的.如果是图片,那就难搞了.你得用专业的分析工具,但也不一定能分析正确.
      

  2.   

    用System.Net.WebRequest模拟网页登录.返回一个System.Net.WebResponse.有验证码的.如果是图片,那就难搞了.你得用专业的分析工具,但也不一定能分析正确.
      

  3.   

    用System.Net.WebRequest模拟网页登录.返回一个System.Net.WebResponse.有验证码的.如果是图片,那就难搞了.你得用专业的分析工具,但也不一定能分析正确.
      

  4.   

    直接用web写,把winform当作一个皮肤,把web浏览器嵌入到winform中
      

  5.   

    可以,我们公司一个哥们就是专门做这个的.
    首先诉你是可以的,
    用System.Net.WebRequest模拟网页登录.
    返回一个System.Net.WebResponse.
    要等到验证码,就要从返回的结果中分析页面中的图片的路径再读取出来 .验证码一般都是这样的 <image src='yanzhengma.aspx' /> 你就要返回的页面中找到这个"yanzhengma.aspx"的位置,
    还有一点,还要保持与目标站点的SESSION ,其实 asp.net 的SESSION 是与 cookies 中的 aspnetsession 有关系的, JSP中的是 与一个名为 JSESSION 的COOKIES有关的,
    保持SESSION ,其实也就是你把目录网站写到客户端的SESSION 等到并在下次提交的时候返回去.
      

  6.   

    还有一点,yanzhengma.aspx中的返回的其实是一个二进制的流,你只要把它显示成图片就OK了.
      

  7.   

    zbw911
    在返回的页面流中找到图片的二进制流部分?
      

  8.   

    WebBrowser
    CSDN以前就有个WINFORM的访问工具带源码的
    你找找看
      

  9.   

    主要的技术在于验证码识别
    模拟提交可以使用WebRequest或者WebClient都可以
    具体可以参考 CSDN论坛助手
      

  10.   


     if (this.webBrowser1.ReadyState.ToString() == "Complete")
                {
                  
                        HTMLDocument dvc = this.webBrowser1.Document.DomDocument as HTMLDocument;
                        HTMLDocument sd = this.webBrowser1.Document.DomDocument as HTMLDocument;
                        HtmlWindow windowf = webBrowser1.Document.Window.Frames[1];
                        dvc = windowf.Document.DomDocument as HTMLDocument;            
                            foreach (IHTMLImgElement x in dvc.images)
                            {
                                if (x.src.IndexOf("inc/GetCode.asp") > -1)
                                {
                                    imgRange = (IHTMLControlRange)body.createControlRange();
                                    imgRange.add((IHTMLControlElement)x);
                                    imgRange.execCommand("Copy", false, null);
                                    bmp = (Bitmap)Clipboard.GetDataObject().GetData(DataFormats.Bitmap);
                                    //bmp.Save(@"now_12.bmp");
                                }
                            }}+++++++++++++++++++++++++++++++++++++++++++++++++++很简单的,把验证码页判断并另存为二进制流或图片都成,偶的代码里有,楼主改改就用。
    不过偶访问的网址是框架集,所以获取this.webBrowser1.Document的时候要区别一下。
      

  11.   

    HTMLDocument doc = webBrowser3.Document.DomDocument as HTMLDocument;
                        HtmlWindow window = webBrowser3.Document.Window.Frames[0];
                        doc = window.Document.DomDocument as HTMLDocument;                    HTMLInputElementClass input = doc.all.item("username", 0) as HTMLInputElementClass;
                        input.value = username;                    input = doc.all.item("passwd", 0) as HTMLInputElementClass;
                        input.value = passwd;                    input = doc.all.item("rmNum", 0) as HTMLInputElementClass;
                        input.value = rmNum;                                        input = doc.all.item("Submit", 0) as HTMLInputElementClass;
                        input.click();
    +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
      HTMLDocument d11 = webBrowser1.Document.DomDocument as HTMLDocument;
                        HtmlWindow window11 = webBrowser1.Document.Window.Frames[1];
                        d11 = window11.Document.DomDocument as HTMLDocument;                    HTMLInputElementClass input11 = d11.all.item("txtUserID", 0) as HTMLInputElementClass;
                        input11.value = username;                    input11 = d11.all.item("txtPassword", 0) as HTMLInputElementClass;
                        input11.value = passwd;                    input11 = d11.all.item("vCode", 0) as HTMLInputElementClass;
                        input11.value = rmNum;                    input11 = d11.all.item("btnLogin", 0) as HTMLInputElementClass;
                        input11.click();
    以上是模拟提交。
      

  12.   

    Fooo(四月·我爱我妻) 
    非常感谢!!!我去试