实在搞不定了,谁能帮我用HttpWebRequest实现登录这个网站进行操作。
地址:http://222.216.28.167:10011/index.html
账号:26488685
密码:123456
登录后在“服务器管理”里进行“停止”或“开始”操作
我现在用的代码:
===============================================
// 登录
System.Net.CookieContainer mcc = PostLogin();
// 模似 "停止 "按钮
this.tbReturnHtml.Text = GETCommand( "http://222.216.28.167:10011/stop_uvs.uscmd?ID=460474 ", mcc);
============================================================
public static CookieContainer PostLogin()
{
string url = "http://222.216.28.167:10011/login.uscmd ";
string args = "username=26488685&password=123456 ";
string outdata = " ";
Encoding encoding = Encoding.GetEncoding( "gb2312 ");
CookieCollection myCookies = null;
CookieContainer myCookieContainer = new CookieContainer();
HttpWebRequest myHttpWebRequest = (HttpWebRequest)WebRequest.Create(url);
myHttpWebRequest.Accept = "image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-excel, application/msword, application/x-shockwave-flash, */* ";
myHttpWebRequest.Referer = "http://222.216.28.167:10011/ ";
myHttpWebRequest.UserAgent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; Maxthon; .NET CLR 2.0.50727) ";
myHttpWebRequest.ContentType = "application/x-www-form-urlencoded ";
myHttpWebRequest.Method = "POST ";
myHttpWebRequest.CookieContainer = myCookieContainer;
// 写入
byte[] b = encoding.GetBytes(args);
myHttpWebRequest.ContentLength = b.Length;
using (System.IO.Stream sw = myHttpW