。NET模拟登陆网站问题
如何能模拟登陆 网站目标网站http://my.
用网上找的代码 登陆不了 请高手指点问题所在
万分感谢
string url = "http://my.
//建立Request对象
HttpWebRequest MyRequest = (HttpWebRequest)HttpWebRequest.Create(url);
MyRequest.Method = "POST";
MyRequest.ContentType = "application/x-shockwave-flash";
//将URL编码
string UrlPara = "username=diandian5026&userpwd=0000000&url=/my/My_Pmc.php&x=61&y=26";
//将URL编码后转换为字节
byte[] ConvertPara = System.Text.Encoding.UTF8.GetBytes(UrlPara);
MyRequest.ContentLength = ConvertPara.Length;
//获得请求流
Stream Out = MyRequest.GetRequestStream();
//将参数写入流
Out.Write(ConvertPara, 0, ConvertPara.Length);
Out.Close();
//发送请求
HttpWebResponse MyResponse = (HttpWebResponse)MyRequest.GetResponse();
//获得相应COOKIE
CookieCollection Cookie = MyResponse.Cookies;
//获得流内容
Stream s = MyResponse.GetResponseStream();
StreamReader Read = new StreamReader(s,Encoding.Default);
Label1.Text = Read.ReadToEnd();