HttpWebRequest myHttpWebRequest = (HttpWebRequest)WebRequest.Create("action页面");
myHttpWebRequest.AllowAutoRedirect =true;
myHttpWebRequest.Method="POST";
myHttpWebRequest.ContentType = "application/x-www-form-urlencoded";
myHttpWebRequest.UserAgent=".net writer gpc";
//传递参数
PostStr="";
PostStr=PostStr+"pwd="+Server.UrlEncode("aHh4bQ==");
PostStr=PostStr+"&cpid="+Server.UrlEncode(basecpid);
PostStr=PostStr+"&srvid="+Server.UrlEncode(baseserverid);
PostStr=PostStr+"&cmd="+Server.UrlEncode(basecmd)
SomeBytes = Encoding.ASCII.GetBytes(PostStr);
myHttpWebRequest.ContentLength = SomeBytes.Length;
Stream newStream = myHttpWebRequest.GetRequestStream();
newStream.Write(SomeBytes,0,SomeBytes.Length);
newStream.Close();
HttpWebResponse myHttpWebResponse = (HttpWebResponse)myHttpWebRequest.GetResponse();
StreamReader srRead = new StreamReader(myHttpWebResponse.GetResponseStream),System.Text.Encoding.ASCII);
string mystr=srRead.ReadToEnd();//得到的结果