日期:2014-05-19 浏览次数:20795 次
Encoding encoding = Encoding.GetEncoding("utf-8"); WebRequest request = WebRequest.Create("http://localhost:8080/system/cardLoginAction.do"); request.Method = "POST"; byte[] postData = encoding.GetBytes(""+name+","+pwd+""); request.ContentLength = postData.Length; Stream postStream = request.GetRequestStream(); postStream.Write(postData, 0, postData.Length); postStream.Close(); WebResponse webResponse = request.GetResponse(); StreamReader streamReader = new StreamReader(webResponse.GetResponseStream(), encoding); String resHtml = streamReader.ReadLine(); streamReader.Close(); webResponse.Close(); return resHtml;