responseXML问题

cgd0282 2007-12-22 11:18:23
在客户端用JS脚本创建Microsoft.XMLHTTP用 httpxml.responseXML是没问题的.
但是在ASP服务端用
<%
...
Set httpxml = Server.CreateObject("Microsoft.XMLHTTP")
httpxml.Open "POST", "XXX/xxx.xml", False, "", ""
httpxml.Send()
...
%>
然后用
strResult = httpxml.responseXML
时说 "对象不支持此属性或方法"原因就是这个responseXML的问题.
如果用strResult = httpxml.responseXML.xml
则strResult 是空的.为什么在服务端responseXML有这问题呢.
说明: 我用httpxml.getAllResponseHeaders() 输出HTTP头的Content-Type 已经是 text/xml 的了.
那位还知道需要其他设置或什么的吗?
...全文
90 1 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
  • 打赏
  • 举报
回复
加上set命令,因为responseXML 是对象,而且要完整的URL路径

Function   PostHttpPage(PostUrl)   
Dim xmlHttp
Set xmlHttp =server.CreateObject("Microsoft.XMLHTTP")
xmlHttp.Open "GET",PostUrl,False
xmlHttp.send()
If Err.Number<>0 Then
Set xmlHttp=Nothing
PostHttpPage ="无法获取内容!"
Exit Function
End If
dim xmlDoc
set xmlDoc=xmlHttp.responseXML
Set xmlHttp=nothing
response.write xmlDoc.xml
End Function
dim Url:Url="http://"&request.servervariables("Http_Host")&"/vb/test.xml"'注意要完整的Url路径,要不执行PostHttpPage的xmlHttp.Open "GET",PostUrl,False出错
PostHttpPage(Url)

52,792

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 Ajax
社区管理员
  • Ajax
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧