Pinging using ASP.Net

  • Thread starter Thread starter pepsi
  • Start date Start date
P

pepsi

Using ASP.Net I need to find out if a particular server is
up and running. I know the IP Address and name of the
server. Its something similar to ping command but I need
to have it at the click of a button for some reason. All I
need to know is if the server is running.

Any help is greatly appreciated.

Pepsi
 
try this, shows you how to do it via sockets in a simple web service, from
there its easy to wrap an asp.net page around it

http://www.411asp.net/home/tutorial/howto/networkf/pingfunc

--
Regards

John Timney (Microsoft ASP.NET MVP)
----------------------------------------------
<shameless_author_plug>
Professional .NET for Java Developers with C#
ISBN:1-861007-91-4
Professional Windows Forms
ISBN: 1861005547
Professional JSP 2nd Edition
ISBN: 1861004958
Professional JSP
ISBN: 1861003625
Beginning JSP Web Development
ISBN: 1861002092
</shameless_author_plug>
 
You can import System.Net and do something like this in
the click event of your button:

Dim server As String = "207.46.134.222"

Try
Dim hostInfo As IPHostEntry = Dns.GetHostByAddress(server)
Catch ex As Exception
Response.Write("OFF, host turned off")
End Try
 
Back
Top