<%
'-----------send.asp-----------------------
set xmlhttp=server.createObject("Microsoft.XMLHTTP")
xmlhttp.open "post","http://localhost/sm/get.asp",false
xmlhttp.setRequestHeader "content-type","text/xml"
xmlhttp.send "<?xml version='1.0'?><a> 如何解决XMLHTTP提交过时返回的是乱码,这是先提交上去,再返回的文字。</a>"
response.write xmlhttp.responseXML.xml
%>
<%@ Language=VBScript %>
<%
'--------------------get.asp---------------------
Response.ContentType = "text/xml"
Response.CharSet = "GB2312"
Dim varCount,varReq,xmldom
varCount = Request.TotalBytes
varReq = Request.BinaryRead(varCount)
If Request.ServerVariables("REQUEST_METHOD") = "POST" Then
Set xmldom = Server.CreateObject("MSXML2.DOMDocument")
xmldom.load varReq
Response.Write "<?xml version=""1.0"" encoding=""GB2312""?>" & xmldom.documentElement.xml
Else
Response.Write "<?xml version=""1.0"" encoding=""GB2312""?><a>如何解决XMLHTTP提交过时返回的是乱码,这是从服务器直接返回的文字。</a>"
End If
%>