if you are web.form, try<html><head>
<script language="javascript">
function sendXml()
{
var http = new ActiveXObject("Microsoft.XMLHTTP");
http.open("POST", "TestXml.aspx", false);
http.setRequestHeader("Content-Type","text/xml");
http.send("<root>hello" + Math.random() + "</root>");
if (http.status == 200)
alert(http.responseText);
else
alert(http.statusText);
}
</script>
</head><body>
<input type="button" value="send" onclick="sendXml()">
</body></html>
<%@ Import Namespace="System.Xml" %>
<script language="C#" runat="server">
void Page_Load(Object o, EventArgs e)
{
if (Request.ContentType.ToLower() == "text/xml")
{
XmlDocument xmldoc = new XmlDocument();
xmldoc.Load(Request.InputStream);
Response.Write(xmldoc.InnerXml);
Response.End();
}
}
</script>
<script language="javascript">
function sendXml()
{
var http = new ActiveXObject("Microsoft.XMLHTTP");
http.open("POST", "TestXml.aspx", false);
http.setRequestHeader("Content-Type","text/xml");
http.send("<root>hello" + Math.random() + "</root>");
if (http.status == 200)
alert(http.responseText);
else
alert(http.statusText);
}
</script>
</head><body>
<input type="button" value="send" onclick="sendXml()">
</body></html>
<%@ Import Namespace="System.Xml" %>
<script language="C#" runat="server">
void Page_Load(Object o, EventArgs e)
{
if (Request.ContentType.ToLower() == "text/xml")
{
XmlDocument xmldoc = new XmlDocument();
xmldoc.Load(Request.InputStream);
Response.Write(xmldoc.InnerXml);
Response.End();
}
}
</script>
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货