想做一个抓包注册的东西
这是我抓出来的点击注册时候的数据 是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;
}
提交以后怎么返回的数据还是原来的页面啊 很是郁闷啊