验证码  手动输入 即可 

解决方案 »

  1.   

     string uname = "";
            private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
            {
                if (webBrowser1.Url.ToString() == "https://passport.baidu.com/?reg")
                {
                    FileStream fs = new FileStream("baidu.txt", FileMode.Append);
                    StreamWriter sw = new StreamWriter(fs, Encoding.Default);
                    sw.Write(uname + "-----" + txtPwd.Text + "\r\n");
                    sw.Close();
                    fs.Close();
                    fs.Dispose();
                    webBrowser1.Navigate("https://passport.baidu.com/?reg&tpl=mn");
                }
                if (webBrowser1.ReadyState > WebBrowserReadyState.Interactive)
                {
                    Random rd = new Random();
                    uname = txtname.Text + rd.Next(100) + 20; ;
                    HtmlDocument hd = webBrowser1.Document;
                    HtmlElement usernameforload = hd.GetElementById("usernameforload");
                    usernameforload.InnerText = uname;
                    HtmlElement txtloginpass = hd.GetElementById("txtloginpass");
                    txtloginpass.InnerText = txtPwd.Text;
                    HtmlElementCollection verifypass = hd.GetElementsByTagName("INPUT");
                    for (int i = 0; i < verifypass.Count; i++)
                    {
                        if (verifypass[i].Name == "verifypass")
                        {
                            verifypass[i].InnerText = txtPwd.Text;
                            break;
                        }
                    }
                    HtmlElement email_address = hd.GetElementById("email_address");
                    email_address.InnerText = "[email protected]";
                    HtmlElement sex = hd.GetElementById("sex");
                    sex.SetAttribute("checked", "checked");
                    HtmlElement btn_submit = hd.GetElementById("btn_submit");
                    btn_submit.InnerText = "批量注册百度账号";
                }
            }
            private void button1_Click(object sender, EventArgs e)
            {
                webBrowser1.Navigate("https://passport.baidu.com/?reg&tpl=mn");
            }不知道对你有没有用
      

  2.   

    有用  但是 能不用 webBrowser吗 谢谢了 
      

  3.   

    如果是winform实现,remoting,wcf技术是可以实现滴
    楼主可以从这两方面看看。。
      

  4.   

    你 这是模拟的应该要用到webBrowser1的吧?
      

  5.   

    模拟 post可以的 我研究的以前 可以用 最近不成了 哈哈
      

  6.   

    http://wenku.baidu.com/view/c1b49a36a32d7375a4178090.html
      

  7.   

    要下班了,没时间写代码webrequest webresponse不行吗
      

  8.   

    webrequest 不行 模拟提交 没有反应 
      

  9.   

    webrequest 不行 模拟提交 没有反应 
      

  10.   

    建立一个C# 项目叫做code
    将下面代码粘贴到相应文件当中:一共两个文件Form1.Designer.cs:
    namespace code
    {
        partial class Form1
        {
            /// <summary>
            /// 必需的设计器变量。
            /// </summary>
            private System.ComponentModel.IContainer components = null;        /// <summary>
            /// 清理所有正在使用的资源。
            /// </summary>
            /// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
            protected override void Dispose(bool disposing)
            {
                if (disposing && (components != null))
                {
                    components.Dispose();
                }
                base.Dispose(disposing);
            }        #region Windows 窗体设计器生成的代码        /// <summary>
            /// 设计器支持所需的方法 - 不要
            /// 使用代码编辑器修改此方法的内容。
            /// </summary>
            private void InitializeComponent()
            {
                this.pictureBox1 = new System.Windows.Forms.PictureBox();
                this.button1 = new System.Windows.Forms.Button();
                this.textBox1 = new System.Windows.Forms.TextBox();
                this.button2 = new System.Windows.Forms.Button();
                ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
                this.SuspendLayout();
                // 
                // pictureBox1
                // 
                this.pictureBox1.Location = new System.Drawing.Point(12, 12);
                this.pictureBox1.Name = "pictureBox1";
                this.pictureBox1.Size = new System.Drawing.Size(100, 50);
                this.pictureBox1.TabIndex = 0;
                this.pictureBox1.TabStop = false;
                // 
                // button1
                // 
                this.button1.Location = new System.Drawing.Point(12, 95);
                this.button1.Name = "button1";
                this.button1.Size = new System.Drawing.Size(75, 23);
                this.button1.TabIndex = 1;
                this.button1.Text = "看不清楚";
                this.button1.UseVisualStyleBackColor = true;
                this.button1.Click += new System.EventHandler(this.button1_Click);
                // 
                // textBox1
                // 
                this.textBox1.Location = new System.Drawing.Point(12, 68);
                this.textBox1.Name = "textBox1";
                this.textBox1.Size = new System.Drawing.Size(100, 21);
                this.textBox1.TabIndex = 2;
                // 
                // button2
                // 
                this.button2.Location = new System.Drawing.Point(93, 95);
                this.button2.Name = "button2";
                this.button2.Size = new System.Drawing.Size(75, 23);
                this.button2.TabIndex = 3;
                this.button2.Text = "确定";
                this.button2.UseVisualStyleBackColor = true;
                this.button2.Click += new System.EventHandler(this.button2_Click);
                // 
                // Form1
                // 
                this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
                this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
                this.ClientSize = new System.Drawing.Size(292, 266);
                this.Controls.Add(this.button2);
                this.Controls.Add(this.textBox1);
                this.Controls.Add(this.button1);
                this.Controls.Add(this.pictureBox1);
                this.Name = "Form1";
                this.Text = "Form1";
                ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
                this.ResumeLayout(false);
                this.PerformLayout();        }        #endregion        private System.Windows.Forms.PictureBox pictureBox1;
            private System.Windows.Forms.Button button1;
            private System.Windows.Forms.TextBox textBox1;
            private System.Windows.Forms.Button button2;
        }
    }
    Form1.cs:
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Text;
    using System.Windows.Forms;using System.Drawing;using System.Drawing.Drawing2D;using System.Drawing.Imaging;
    namespace code
    {
        public partial class Form1 : Form
        {
            public String sRand = "";
            public Form1()
            {
                InitializeComponent();
                draw();
            }        private Color getRandColor(int fc, int bc)
            {
                Random random = new Random();
                if (fc > 255) fc = 255;
                if (bc > 255) bc = 255;
                int r = fc + random.Next(bc - fc);
                int g = fc + random.Next(bc - fc);
                int b = fc + random.Next(bc - fc);
                Color c = Color.FromArgb(r, g, b);
                return c;
            }
            public void draw()
            {
                int width = 60, height = 20;
                Bitmap image = new Bitmap(width, height);
                Graphics g = Graphics.FromImage(image);
                Random random = new Random();
                LinearGradientBrush brush = new LinearGradientBrush(new Rectangle(0, 0, 10, 10), getRandColor(200, 250), getRandColor(200, 250), 0F, false);
                g.FillRectangle(brush, 0, 0, width, height);
                Pen p = new Pen(getRandColor(200, 250));
                for (int i = 0; i < 150; i++)
                {
                    int x = random.Next(width);
                    int y = random.Next(height);
                    int xl = random.Next(10);
                    int yl = random.Next(10);
                    g.DrawLine(p, x, y, x + xl, y + yl);
                }
                p = new Pen(Color.Black);
                g.DrawRectangle(p, 0, 0, width - 1, height - 1);
                for (int i = 0; i < 4; i++)
                {
                    String rand = random.Next(10).ToString();
                    sRand += rand;
                    brush = new LinearGradientBrush(new Point(0, 0), new Point(10, 10), Color.Black, Color.Black);
                    g.DrawString(rand, new Font("宋体", 12), brush, 13 * i + 3, 0);
                }
                pictureBox1.Image = image;
            }        private void button1_Click(object sender, EventArgs e)
            {
                draw();
            }        private void button2_Click(object sender, EventArgs e)
            {
                if (textBox1.Text.Equals(sRand))
                {
                    MessageBox.Show("OK");
                }
            }
        }}
      

  11.   

    你不是说winform开发,输入验证码吗?
    你照着做,运行,界面是一个验证码,一个输入框两个按钮,一个“看不清楚”一个“确定”
    点击看不清楚,验证码会随机重置,输入数字点击确定,判断验证码是否正确,正确弹出窗口
    这不就是你要的效果吗?
      

  12.   

    38行少了一句话
    public void draw()
            {
                sRand = "";
                int width = 60, height = 20;
      

  13.   


    哥 你没看标题 呀 
    c#winform模拟注册百度帐号代码
      

  14.   

    晕  你试试 模拟post 实现以下 
      

  15.   

    winfrom不用webBrowser  好像不行吧