WebRequest wrPostURL = WebRequest.Create("http://edzh.com/Get.aspx");
wrPostURL.Method = "POST";
Stream postStream = wrPostURL.GetRequestStream();
//Dom为需要post的数据
byte[] pPostBytes = System.Text.Encoding.UTF8.GetBytes(DOM.OuterXml);
postStream.Write(pPostBytes,0,pPostBytes.Length);
postStream.Flush();
postStream.Close();
//responseStream为返回的xml数据
Stream responseStream = wrPostURL.GetResponse().GetResponseStream();
try
{
XmlDataDocument objXML = new XmlDataDocument();
objXML.Load(responseStream);
return objXML;
}
catch(XmlException ex)
{
throw new Exception(ex.ToSting())
}
-------------------------------------------------
Get.aspx页面部分代码
//接受POST数据
XmlDataDocument xmlDoc = new XmlDataDocument();
try
{
//Request.InputStream为post的数据,xml格式
xmlDoc.Load(Request.InputStream);
}
catch/*(Exception ex)*/
{
//xml格式错误
returnDesc += "Invalid XmlDocument";
}
。。。。
。。。。。。。