byte[] bytes = Encoding.GetEncoding("ascii").GetBytes("");
                WebRequest wr = WebRequest.Create(url);
                HttpWebRequest request = (HttpWebRequest)wr;
                request.UserAgent = "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.2; .NET CLR 1.1.4322; .NET CLR 2.0.50727)";
                request.ContentType = "application/x-www-form-urlencoded";
                request.Method = "POST";
                wr.Proxy = null;
                request.ContentLength = bytes.Length;
                Stream requestStream = request.GetRequestStream();
                requestStream.Write(bytes, 0, bytes.Length);
                requestStream.Close();
                request.Abort();
                wr.Abort();

解决方案 »

  1.   

    模拟浏览器(Windows 2003+IE7)向web网站提交表单数据。
      

  2.   

    这样的提交表单和 WebClient.DownLoadString(Uri) 的区别在那呢
      

  3.   

    我是想问下 注册机器人的写法 是用上面的方法好呢 还是用直接的字符串好呢
    WebClient.DownLoadString(Uri) 
    String Uri=(https://#######.com/loginV4Action.do?frompage=1&type=1&username=admin&password=123456&languages=1_zh&checktype=0) 这两种那个速度快一点 。还有 一点 最上面的 表单提交怎么知道 是不是注册成功了呢 没有返回值啊
      

  4.   

    HttpWebRequest用起来麻烦点。不知道你说的返回值是什么东西,如果是返回的请求网页内容,HttpWebRequest当然可以获取。
      

  5.   

    我觉得HttpWebRequest 好