xmlhttp为什么没有权限?

dreamsun 2004-01-09 06:18:36
为什么下面这段代码没有权限>????
<script language="vbscript">
dim sUrl
sUrl="http://www.90live.com/chat/news.xml"
Function streamtochar(StrStream)
set stream=CreateObject("ADODB.Stream")
stream.type=1
stream.Mode=3
stream.Open
stream.Write Strstream
stream.Position= 0
stream.Type= 2
stream.Charset="gb2312"
streamtochar= stream.ReadText
stream.Close
set stream=nothing
End Function
i = i + 1
function getContentByUrl(url)

'建立对象
set oXmlHttp = CreateObject("MSXML2.XMLHTTP")

oXmlHttp.open "GET",url,false

oXmlHttp.send

getContentByUrl = streamtochar(oXmlHttp.responseBody)

set oXmlHttp=nothing
end function


'函数,获得网站内容
function getRealContent(url)
sContent = getContentByUrl(url)


getRealContent=sContent
end function
msgbox getContentByUrl(surl)
</script>


但如果改成了asp文件却又可以:
<%
dim sUrl
sUrl="http://www.90live.com/chat/news.xml"
Function streamtochar(StrStream)
set stream=CreateObject("ADODB.Stream")
stream.type=1
stream.Mode=3
stream.Open
stream.Write Strstream
stream.Position= 0
stream.Type= 2
stream.Charset="gb2312"
streamtochar= stream.ReadText
stream.Close
set stream=nothing
End Function
i = i + 1
function getContentByUrl(url)

'建立对象
set oXmlHttp = CreateObject("MSXML2.XMLHTTP")

oXmlHttp.open "GET",url,false

oXmlHttp.send

getContentByUrl = streamtochar(oXmlHttp.responseBody)

set oXmlHttp=nothing
end function


'函数,获得网站内容
function getRealContent(url)
sContent = getContentByUrl(url)


getRealContent=sContent
end function
response.write getContentByUrl(surl)
%>

真是麻烦啊~~~怎么回事呢
...全文
83 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
dreamsun 2004-01-10
  • 打赏
  • 举报
回复
呵,adodb.stream我是后来套上去的,如果只是为了得到xml,如你所言,也用不到adodb.stream.

烦,我现在还没测试出来怎么解决上面的问题
孟子E章 2004-01-10
  • 打赏
  • 举报
回复
如果你想在客户端用ADODB.Stream,建议还是不要用,ado版本不同会有问题
dreamsun 2004-01-09
  • 打赏
  • 举报
回复
安全性用户不懂得设置的,而且作为网站本身,不可能要求用户迁就你的网站

我只能一个一个地试孟子说的办法
仙人掌 2004-01-09
  • 打赏
  • 举报
回复
IE安全设置改为低就可以了
孟子E章 2004-01-09
  • 打赏
  • 举报
回复
查看安全性
http://msdn.microsoft.com/isapi/gomscom.asp?TARGET=/downloads/details.aspx?FamilyID=6c050fe3-c795-4b7d-b037-185d0506396c&DisplayLang=en
孟子E章 2004-01-09
  • 打赏
  • 举报
回复
sorry

set oXmlHttp = CreateObject("Microsoft.xmlhttp")看看
孟子E章 2004-01-09
  • 打赏
  • 举报
回复
直接
xmldom.setProperty ServerHTTPRequest,True
xmldom.load(url)
孟子E章 2004-01-09
  • 打赏
  • 举报
回复
如果你想得到 xml,你不需要用ADODB.Stream
孟子E章 2004-01-09
  • 打赏
  • 举报
回复
set oXmlHttp = CreateObject("Microsoft.XMLDOM")看看

另外:
set stream=CreateObject("ADODB.Stream")
看是否创建成功,估计是这个的问题

8,906

社区成员

发帖
与我相关
我的任务
社区描述
XML/XSL相关问题讨论专区
社区管理员
  • XML/XSL社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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