我想用.net实现在打开一个网页时自动填写用户名和密码,如打开http://passport.csdn.net/UserLogin.aspx时自动填写用户名:aaaa,密码:123456

解决方案 »

  1.   

    很简单,分析一下 该网页的源码就可以
    http://www.cnblogs.com/feifeiwzh/archive/2009/06/14/1503042.html
      

  2.   

     // 要提交表单的URI字符串。
           string uriString = "http://www.xxx.com/Login.aspx";
           // 要提交的字符串数据。
           string postString = "userName=user1&password=password1";
           // 初始化WebClient
           WebClient webClient = new WebClient();
           webClient.Headers.Add("Content-Type", "application/x-www-form-urlencoded");
           // 将字符串转换成字节数组
           byte[] postData = Encoding.ASCII.GetBytes(postString);
           // 上传数据,返回页面的字节数组
           byte[] responseData = webClient.UploadData(uriString, "POST", postData);
           // 返回的将字节数组转换成字符串(HTML)
           string srcString = Encoding.UTF8.GetString(responseData);给看一下这段代码是否能实现自动填表,代码来自于3楼