怎样知道远程服务器上的文件是否存在

Bizza 2003-10-18 10:36:21
我在 http://www.rasea.com/checkfile.asp 里进行判断文件http://www.csdn.net/sms.exe 是否存在,如果存在的话,
进入home.asp,否则进入error.asp

如何判断呢?
...全文
96 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
Bizza 2003-10-19
  • 打赏
  • 举报
回复
我安装了xml3 ,怎么还是提示上面的错误?
yllaji 2003-10-19
  • 打赏
  • 举报
回复
E章厉害啊…… 我以为计算机本来就有那个呢………………
hxy2003 2003-10-18
  • 打赏
  • 举报
回复
收下啦
yllaji 2003-10-18
  • 打赏
  • 举报
回复
哎…… 才30分啊…… 哎……

下面的代码 可以获取页面里的所有内容

你自己看着办 呵呵

<%
Function getHTTPPage(url)
'on error resume next
dim http
set http=Server.createobject("Microsoft.XMLHTTP")
Http.open "GET",url,false
Http.send()
if Http.readystate<>4 then
exit function
end if
getHTTPPage=bytes2BSTR(Http.responseBody)
set http=nothing
if err.number<>0 then err.Clear
End function

Function bytes2BSTR(vIn)
dim strReturn
dim i,ThisCharCode,NextCharCode
strReturn = ""
For i = 1 To LenB(vIn)
ThisCharCode = AscB(MidB(vIn,i,1))
If ThisCharCode < &H80 Then
strReturn = strReturn & Chr(ThisCharCode)
Else
NextCharCode = AscB(MidB(vIn,i+1,1))
strReturn = strReturn & Chr(CLng(ThisCharCode) * &H100 + CInt(NextCharCode))
i = i + 1
End If
Next
bytes2BSTR = strReturn
End Function
%>
<%=getHTTPPage("http://www.csdn.net/sms.exe")%>
bineon 2003-10-18
  • 打赏
  • 举报
回复
e章真是猛

——————————————————————————————————
www.91asp.cn
有时间到这里找资料找书籍,你会发现asp以及.net很容易!
前提是你努力学习!
孟子E章 2003-10-18
  • 打赏
  • 举报
回复
http://download.microsoft.com/download/2/4/6/2464a96d-f368-4396-b119-d2df724ec181/msxml3chs.msi

qdubit 2003-10-18
  • 打赏
  • 举报
回复
热烈关注!
孟子E章 2003-10-18
  • 打赏
  • 举报
回复
<%
dim http
set http=Server.createobject("Microsoft.XMLHTTP")
Http.open "HEAD","http://www.csdn.net/sms.exe",false
Http.send()
If Http.status = 200 Then
Response.Redirect "home.asp"
Else
Response.Redirect "error.asp"
End If

%>
孟子E章 2003-10-18
  • 打赏
  • 举报
回复
<%
dim http
set http=Server.createobject("Microsoft.XMLHTTP")
Http.open "HEAD","http://www.csdn.net/sms.exe",false
Http.send()
If Http.status = 200 Then
Response.Redirect "http://www.csdn.net/sms.exe"
Else
Response.write "不存在"
End If

%>
你需要安装xml3
Bizza 2003-10-18
  • 打赏
  • 举报
回复
有问题啊,以下是代码.(再加分)
______________________________________________________________
msxml3.dll 错误 '800c0005'

系统未找到指定的资源。

/rasea/GetHttpPage.asp,行 7
---------------------------------------------------------------

:)

28,391

社区成员

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

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