当前位置:编程学习 > C#/ASP.NET >>

在HTTPS下,如何用 POST 实现传输 XML ?

问题是这样的。
有两台服务器,A和B。 在服务器A建立一个Windows的任务,定期向服务器B发送请求。
服务器B接收到请求后,验证传输过来的参数无误后,向服务器A返回写在XML里的数据。
数据量可能会比较大。
以上这些都是不经过页面,在后台实现的。但是我现在做过的只有ASP.NET实现的页面上的跳来跳去,在后台服务器上如何实现这个自动通信的功能呢?

--------------------编程问答-------------------- string url = "****";
            string formData = "";//你的XML
            byte[] postData = Encoding.UTF8.GetBytes(formData);
            HttpWebRequest webrequest = (HttpWebRequest)HttpWebRequest.Create(url);
            webrequest.Method = "post";
            webrequest.Accept = "text/html, application/xhtml+xml, */*";
            webrequest.ContentType = "application/x-www-form-urlencoded";
            webrequest.ContentLength = postData.Length;

// 提交请求数据 
            System.IO.Stream outputStream = webrequest.GetRequestStream();
            outputStream.Write(postData, 0, postData.Length);
            outputStream.Flush();
            outputStream.Close(); --------------------编程问答-------------------- cuthkid,太感谢了!!

还想问一下,提交了请求数据后,另一个服务器怎么接收呢?
补充:.NET技术 ,  C#
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,