日期:2014-05-17  浏览次数:21323 次

帮忙分析个模拟POST,版主,求助啊
自己弄了个   dz2.5的论坛,想模拟这个版本的POST注册,为什么不可以呢,我什么限制都没开啊

http://m8iu.com/member.php?mod=register

这是注册的网站,我的代码如下,会提示来路不正确


  
            HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://www.m8iu.com/member.php?mod=register&inajax=1");
            request.Method = "POST";
            request.CookieContainer = cookie;
            request.ContentType = "multipart/form-data; boundary=---------------------------7ddc8a806ce";
            request.Connection = "Keep - Alive";
            request.UserAgent = "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)";
            request.Referer = "http://m8iu.com/member.php?mod=register";
            request.Accept = "text/html, application/xhtml+xml, */*";
             string str = textBox1.Text.Replace("{name}","asdasd");
            str = str.Replace("{pwd}","521521");
            str = str.Replace("{youjian}","asdasdas@qq.com");

            byte[] b=Encoding.UTF8.GetBytes(str);
            request.GetRequestStream().Write(b,0,b.Length);
            request.GetRequestStream().Close();
            HttpWebResponse response = (HttpWebResponse)request.GetResponse();
            
            System.IO.StreamReader read = new System.IO.StreamReader(response.GetResponseStream());
        MessageBox.Show(read.ReadToEnd());

------解决方案--------------------
既然是你自己搞的,去研究一下论坛的源码不就知道为什么来路不正确了。