请问在ASP中如何实现ping?

beyondme 2000-07-10 05:43:00
...全文
119 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
wumou 2000-07-13
  • 打赏
  • 举报
回复
www.serverobject.com好像有aspping组件,总之用组件很省事,反正原理很简单.
beyondme 2000-07-13
  • 打赏
  • 举报
回复
Set WShShell = Server.CreateObject("WScript.Shell")
这行提示说“无效字符”!
bluewater 2000-07-13
  • 打赏
  • 举报
回复
如何在ASP中实现PING
 使用WSH调用系统的Ping命令,将Ping的结果重定向到一个文本文件中去,再把文本文件显示到网页中
  具体做法如下:首先,建一个.BAT文件(例如:myPing.BAT:),这个文件要在ASP中调用,文件代码如下:ping -a %1 > d:INetPubcgi-bin%2.txt (%1)是将来要ping的地址, (%2)是存储ping结果的文件.以下是ASP的代码:
  <%Set FileSys = Server.CreateObject("Scripting.FileSystemObject")FileName = FileSys.GetTempName
  Set WShShell = Server.CreateObject("WScript.Shell")
  IP = "xxx.xxx.xxx.xxx" '你要ping的地址RetCode = WShShell.Run("d:Inetpubcgi-binmyPing.bat " & IP & " " & FileName, 1, True)
  if RetCode = 0 Then'没有错误elseResponse.Redirect "PingErrors.htm"end if
  Set TextFile = FileSys.OpenTextFile("d:InetPubcgi-bin" & FileName & ".txt", 1)TextBuffer = TextFile.ReadAll
  For i = 1 to Len(TextBuffer)
  If Mid(TextBuffer,i,1) = chr(13) Then
  Response.Write("<BR>")
  else
  Response.Write(Mid(TextBuffer,i,1))
  end if
  Next
  TextFile.Close
  FileSys.DeleteFile "d:Inetpubcgi-bin" & FileName & ".txt"
  %>



beyondme 2000-07-10
  • 打赏
  • 举报
回复
你是说 Set WShShell = Server.CreateObject("WScript.Shell") ?但是会提示错误的!
kxy 2000-07-10
  • 打赏
  • 举报
回复
写一个asp对象

28,390

社区成员

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

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