'本程序仅供参考,请勿用于非法用途 Dim strId AsString="lishewen" Dim strPassword AsString="123456" '定义编码器 Dim encoding AsNew ASCIIEncoding() Dim postData AsString="userid="+ strId postData += ("&password="+ strPassword) Dim data AsByte() = encoding.GetBytes(postData) '获得HttpWebRequest对象 Dim myRequest As HttpWebRequest =DirectCast(WebRequest.Create("http://www.lishewen.com/login.asp"), HttpWebRequest) myRequest.Method ="POST" myRequest.ContentType ="application/x-www-form-urlencoded" myRequest.ContentLength = data.Length Dim newStream As Stream = myRequest.GetRequestStream() '发送数据 newStream.Write(data, 0, data.Length) newStream.Close() '接收返回信息 Dim myResponse As HttpWebResponse =DirectCast(myRequest.GetResponse(), HttpWebResponse) Dim reader AsNew StreamReader(myResponse.GetResponseStream(), System.Text.Encoding.[Default]) Dim content AsString= reader.ReadToEnd() Console.WriteLine(content)