首页 新闻 会员 周边 捐助

post 数据后海在原页面

0
悬赏园豆:10 [待解决问题]

想做一个抓包注册的东西

这是我抓出来的点击注册时候的数据 是get方式提交的 然后我把url拼接好以后用方法

public HttpWebResponse SendRequest(string method, string url, string referer, byte[] buffer, string contenttype, string cookies, string host)
{
//参考上面......
HttpWebRequest request = WebRequest.Create(new Uri(url)) as HttpWebRequest;
ServicePointManager.ServerCertificateValidationCallback
= new System.Net.Security.RemoteCertificateValidationCallback(CheckValidationResult);
request.Method
= method;
request.Timeout
= 100000;
//System.Net.WebProxy proxy = new WebProxy("208.77.186.166", 80);
//request.Proxy = proxy;
if (cookies != null && cookies.Length > 0)
{
string[] cooks = cookies.Split(';');
foreach (string item in cooks)
{
if (item.Contains("="))
{
string[] cookie = item.Split('=');
string name = cookie[0].Trim();
string value = cookie[1].Trim();
this._container.Add(new Uri(host), new Cookie(name, value, "/"));
}
}
}
request.CookieContainer
= this._container;
if (contenttype != null && contenttype.Length > 0)
{
request.ContentType
= contenttype;
}
else
{
request.ContentType
= "application/x-www-form-urlencoded";
}
request.UserAgent
= @"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; CIBA; .NET CLR 2.0.50727)";
if (referer != null && referer.Length > 0)
request.Referer
= referer;
if (method.ToUpper() == "POST")
{
if (buffer != null && buffer.Length > 0)
{
Stream stream
= request.GetRequestStream();
stream.Write(buffer,
0, buffer.Length);
stream.Close();
}
}
HttpWebResponse response
= request.GetResponse() as HttpWebResponse;
//设置当前请求返回时的cookie的值
response.Cookies = request.CookieContainer.GetCookies(request.RequestUri);
return response;
}

提交以后怎么返回的数据还是原来的页面啊 很是郁闷啊

问题补充: #region 注册 private void button2_Click(object sender, EventArgs e) { //注册页面的url string url = "http://2010jy.365ta.com/signup.asp"; //拼接参数 Random rd = new Random(System.DateTime.Now.Millisecond); string name = rd.Next(1000000).ToString(); string code = registercode.Text; string param = "action=bmp&tid=1&name=" + name + "&sex=男&age=22&xy=123123&js=123123&img=no.jpg&username=" + txtusername.Text + "&password=8111322&password2=8111322&tel=13520412377&mail=13520412377@qq.com&qq=234234243&textarea=1212wqqw1212qa1qe1121&ty=1&code=" + code + "&Submit2= 报 名 参 赛 "; string result = r.SendRequestGetPage("POST", url, "", param, System.Text.Encoding.GetEncoding("gb2312")); if (result.Contains("投票说明")) { MessageBox.Show("报名成功"); } else { MessageBox.Show("报名失败"); } } #endregion
Ganler1988的主页 Ganler1988 | 初学一级 | 园豆:3
提问于:2011-03-18 18:20
< >
分享
所有回答(0)
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册