wrote on 19 mrt 2006 in microsoft.public.inetserver.asp.general:
I want to ping or try to check the avability of a local server. Is
there any way to do it directly from an ASP page just by pressing a
buttun? I just want to do the "ping" command direcdry from an ASP page!
<
http://www.4guysfromrolla.com/webtech/102998-1.shtml>
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Evertjan,
Thanks from your quick replay but it still doesn't work. my doping.bat
file:
ping -a %1 > D:\ccadmin\wwwroot\IT\servers%2.txt
My asp file:
<%
Set FileSys = Server.CreateObject("Scripting.FileSystemObject")
FileName = FileSys.GetTempName
Set WShShell = Server.CreateObject("WScript.Shell")
IP = "w2k-ccadmin" ' or whatever you want to ping
RetCode = WShShell.Run("D:\ccadmin\wwwroot\IT\servers\DoPing.bat " & IP
& " " & FileName, 1, True)
if RetCode = 0 Then
'There were no errors
else
Response.Redirect "PingErrors.htm"
end if
Set TextFile = FileSys.OpenTextFile("D:\ccadmin\wwwroot\IT\servers\" &
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:\ccadmin\wwwroot\IT\servers\" & FileName & ".txt"
%>
"D:\ccadmin\wwwroot\IT\servers\" is the location of the files at the
server i'm working with. I've also checked and the object "RetCode"
equels 1- the reason i'm reaching "PingErrors.htm" each time i'm trying
to activate the asp file .
Thanks,
Shai