晕了!MSXML2.XMLHTTP创建成功,但是不能用Send方法!

isnisn 2003-10-13 12:51:16
在我机器可以用,放到服务器就出问题.
我检查了服务器的注册表,有MSXML2.XMLHTTP这个控件,是2.6版本的,还有3.0版本的.
...全文
327 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
Fyter 2004-01-25
  • 打赏
  • 举报
回复
可能是你机器不能访问外网造成!请查看服务器是否可以浏览外部网站。
icech 2003-10-29
  • 打赏
  • 举报
回复
<%
Dim rs,sql
sInfoTopic=Trim(Request.Form("aInfoTopic")) '文章标题
sInfoFrom=Trim(Request.Form("aInfoFrom")) '来源
sInfoPicInclude=Trim(Request.Form("InfoPicInclude"))
sInfoPicUrl=Trim(Request.Form("InfoPicUrl"))
sUploadFiles=Trim(Request.Form("UploadFiles"))
'大文本的循环导入
For I = 1 To Request.Form("Content").Count
sInfoContent = Request.Form("Content")(I)
Next

sub SaveInfo()
rs("Info_Topic")=sInfoTopic

dim strSiteUrl
strSiteUrl=request.ServerVariables("HTTP_REFERER")
strSiteUrl=lcase(left(strSiteUrl,instrrev(strSiteUrl,"/")))
sInfoContent=replace(sInfoContent,strSiteUrl,"")
sInfoContent=ReplaceRemoteUrl(sInfoContent)
rs("Info_Content")=sInfoContent

if sInfoPicInclude="yes" then
rs("Info_PicInclude")=1
else
rs("Info_PicInclude")=0
end if

if sInfoPicUrl<>"" then
rs("Info_PicShow")=sInfoPicUrl
end if
rs("Info_PicNum")=sUploadFiles

end sub

sub SaveSuccess()
Pram="添加数据库成功!"
REURL="Admin_InfoAdd.asp"
Call WriteJS(Pram,REURL)
End Sub

set rs=server.createobject("adodb.recordset")
if request("Action")="Add" then
sql="select top 1 * from Info"
rs.open sql,conn,1,3
rs.addnew
call SaveInfo()
rs.update
rs.close
elseif request("Action")="Modify" then
if sInfoID<>"" then
sql="select * from info where InfoID=" & sInfoID
rs.open sql,conn,1,3
if not (rs.bof and rs.eof) then
call SaveInfo()
rs.update
rs.close
else
founderr=true
errmsg=errmsg+"<li>不能确定ID的值</li>"
call WriteErrMsg()
end if
else
founderr=true
errmsg=errmsg+"<li>没有选定参数</li>"
call WriteErrMsg()
end if
end if

call CloseConn()

if founderr=true then
call WriteErrMsg()
else
call SaveSuccess()
end if


'==================================================
'过程名:ReplaceRemoteUrl
'作 用:替换字符串中的远程文件为本地文件并保存远程文件
'参 数:strContent ------ 要替换的字符串
'==================================================
function ReplaceRemoteUrl(strContent)
dim re,RemoteFile,RemoteFileurl,SaveFilePath,SaveFileName,SaveFileType,arrSaveFileName,ranNum
SaveFilePath = "UploadFiles" '文件保存的本地路径
if right(SaveFilePath,1)<>"/" then SaveFilePath=SaveFilePath&"/"
Set re=new RegExp '设置配置对象
re.IgnoreCase =true '忽略大小写
re.Global=True '设置为全文搜索
re.Pattern = "((http|https|ftp|rtsp|mms):(\/\/|\\\\){1}((\w)+[.]){1,}(net|com|cn|org|cc|tv|[0-9]{1,3})(\S*\/)((\S)+[.]{1}(gif|jpg|png|bmp)))"
Set RemoteFile = re.Execute(strContent) '开始执行配置
For Each RemoteFileurl in RemoteFile
arrSaveFileName = split(RemoteFileurl,".")
SaveFileType=arrSaveFileName(ubound(arrSaveFileName))
ranNum=int(900*rnd)+100
SaveFileName = SaveFilePath&year(now)&month(now)&day(now)&hour(now)&minute(now)&second(now)&ranNum&"."&SaveFileType
call SaveRemoteFile(SaveFileName,RemoteFileurl)
strContent=Replace(strContent,RemoteFileurl,SaveFileName)
if sUploadFiles="" then
sUploadFiles=SaveFileName
sInfoPicInclude="yes"
else
sUploadFiles=sUploadFiles & "|" & SaveFileName
sInfoPicInclude="yes"
end if
Next
ReplaceRemoteUrl=strContent
end function



'==================================================
'过程名:SaveRemoteFile
'作 用:保存远程的文件到本地
'参 数:LocalFileName ------ 本地文件名
' RemoteFileUrl ------ 远程文件URL
'==================================================
sub SaveRemoteFile(LocalFileName,RemoteFileUrl)
dim Ads,Retrieval,GetRemoteData
Set Retrieval = Server.CreateObject("MSXML2.XMLHTTP") '使用xmlhttp的方法来获得图片的内容
With Retrieval
.Open "Get", RemoteFileUrl, False, "", ""
.Send
GetRemoteData = .ResponseBody
End With
Set Retrieval = Nothing
Set objStream = Server.CreateObject("Adodb.Stream")
With objStream
.Type = 1 '以二进制模式打开
.Open
.Write GetRemoteData
.SaveToFile server.MapPath(LocalFileName),2 '将缓冲的内容写进文件
.Cancel()
.Close()
End With
Set objStream=nothing
end sub
%>
icech 2003-10-29
  • 打赏
  • 举报
回复
不是在服务端执行,而是用在WEB中。
colee 2003-10-29
  • 打赏
  • 举报
回复
var xmlhttp = new ActiveXObject("MSXML2.XMLHTTP");
xmlhttp.open('POST','test.asp',false);
xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xmlhttp.send();
if(xmlhttp.responseText!="") alert(xmlhttp.responseText);
delete(xmlhttp);
应用成功。
或者贴出源码看看
DeltaCat 2003-10-29
  • 打赏
  • 举报
回复
不会吧?
你的MSXML2.HTTP在服务器端执行?
高!!
icech 2003-10-29
  • 打赏
  • 举报
回复
我在本地计算机中 MSXML2.XMLHTTP 的版本是 2.6/3.0/4.0
检测了一下服务器中是2.6/3.0,在本地计算机中调试好好的,但是到了服务器上就出错,why?
icech 2003-10-29
  • 打赏
  • 举报
回复
顶,我也遇到同样的问题,怎么解决?

28,406

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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