本人是C#新手,想编写一个网页游戏的外挂! 现在我还不是很会C#中截取封包的方法!我现在只想一步一步的来,有谁能给我段参考的代码将万分感激! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 核心代码: private string WebRequestMethod(string RequestUrl) { string str = ""; HttpWebRequest request = null; HttpWebResponse response = null; StreamReader reader = null; try { request = (HttpWebRequest) WebRequest.Create(RequestUrl); request.CookieContainer = this.Cookie; request.UserAgent = "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.2; .NET CLR 1.1.4322; .NET CLR 2.0.50727; InfoPath.1) Web-Sniffer/1.0.24"; response = (HttpWebResponse) request.GetResponse(); reader = new StreamReader(response.GetResponseStream(), Encoding.UTF8); str = reader.ReadToEnd(); reader.Close(); response.Close(); } catch (Exception exception) { return ""; } return str.Trim(); } private string RequestPostMethod(string Post_Url, string PostData) { string str = ""; HttpWebRequest request = null; HttpWebResponse response = null; StreamReader reader = null; byte[] bytes = new ASCIIEncoding().GetBytes(PostData); try { request = (HttpWebRequest) WebRequest.Create(Post_Url); request.CookieContainer = this.Cookie; request.UserAgent = "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.2; .NET CLR 1.1.4322; .NET CLR 2.0.50727; InfoPath.1) Web-Sniffer/1.0.24"; request.Method = "POST"; request.ContentType = "application/x-www-form-urlencoded"; request.ContentLength = bytes.Length; Stream requestStream = request.GetRequestStream(); requestStream.Write(bytes, 0, bytes.Length); requestStream.Flush(); requestStream.Close(); response = (HttpWebResponse) request.GetResponse(); reader = new StreamReader(response.GetResponseStream(), Encoding.UTF8); str = reader.ReadToEnd(); reader.Close(); response.Close(); } catch (Exception exception) { return ""; } return str.Trim(); } 顶4楼.LZ可以找一下webbrowser的资料 请教LZ 写网页游戏的WG 从何入手?? 麻烦大家给我解释一下"=>"这个符号的作用. 访问 IIS 元数据库失败 接口应用问题 应该不难的问题 如何使datalist选中行字体加粗 login控件是如何让所有需要验证的页面都需要登陆验证 请高手指点图片问题 有没有高手知道如何能实现像office那样,点击帮助后在窗体的右侧打开帮助文档 WinForm的TextBox的样式能不能设置为只有一条下横线,不是3D的,应该怎么搞?多谢 对不起,我没分了,麻烦哪位回答我的问题。 VS2010智能设备开发???WinCE 写程序结果题
{
string str = "";
HttpWebRequest request = null;
HttpWebResponse response = null;
StreamReader reader = null;
try
{
request = (HttpWebRequest) WebRequest.Create(RequestUrl);
request.CookieContainer = this.Cookie;
request.UserAgent = "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.2; .NET CLR 1.1.4322; .NET CLR 2.0.50727; InfoPath.1) Web-Sniffer/1.0.24";
response = (HttpWebResponse) request.GetResponse();
reader = new StreamReader(response.GetResponseStream(), Encoding.UTF8);
str = reader.ReadToEnd();
reader.Close();
response.Close();
}
catch (Exception exception)
{
return "";
}
return str.Trim();
} private string RequestPostMethod(string Post_Url, string PostData)
{
string str = "";
HttpWebRequest request = null;
HttpWebResponse response = null;
StreamReader reader = null;
byte[] bytes = new ASCIIEncoding().GetBytes(PostData);
try
{
request = (HttpWebRequest) WebRequest.Create(Post_Url);
request.CookieContainer = this.Cookie;
request.UserAgent = "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.2; .NET CLR 1.1.4322; .NET CLR 2.0.50727; InfoPath.1) Web-Sniffer/1.0.24";
request.Method = "POST";
request.ContentType = "application/x-www-form-urlencoded";
request.ContentLength = bytes.Length;
Stream requestStream = request.GetRequestStream();
requestStream.Write(bytes, 0, bytes.Length);
requestStream.Flush();
requestStream.Close();
response = (HttpWebResponse) request.GetResponse();
reader = new StreamReader(response.GetResponseStream(), Encoding.UTF8);
str = reader.ReadToEnd();
reader.Close();
response.Close();
}
catch (Exception exception)
{
return "";
}
return str.Trim();
}
LZ可以找一下webbrowser的资料