Home | Contact Us | Download | Support | Purchase | Products


Product List
 
 

Using aspNetPing from a Non-Visual Studio .NET environment.

Summary

The following steps will demonstrate how to use aspNetPing in a non-Visual Studio .NET environment. For this ASP.NET application to work successfully you will need FTP access or file share access to your website.

Uploading aspNetPing to your ASP.NET application

1. FTP (or through file sharing) connect to your web application.

2. Locate the /Bin directory. If there isn't a directory named Bin you will need to create it under the root directory.

3. Upload the aspNetDns.dll to the /Bin directory.

Creating a Sample Page

Once the aspNetDns.dll has been uploaded, you will be able to create a test ASP.NET page. The following steps will demonstrate this, using both C# and VB.NET.

1. To create a sample page, called pingme.aspx, start Notepad.

2. If you are using C# as your development language, enter the following code. If you are using VB.NET, that code can be found in the next step.

 

[C#]

<%@ Page Language="cs" %>
<%@ Import Namespace="aspNetPing"%>
<HTML>
  <HEAD>
    <title>pingme</title>
<script runat=server>
private void Page_Load(object sender, System.EventArgs e)
{
	if( Page.IsPostBack )
	{
		string hostToPing = txtHost.Value;
		// Put user code to initialize the page here
		ReplyPacketCollection reply = IcmpClient.Ping( hostToPing, 4);
		PingResults.Text = reply.ToString();
		
	}
}



</script>
</HEAD>
  <body >

    <form id="Form1" method="post" runat="server">  
<INPUT id=txtHost type=text runat="server" NAME="txtHost"><INPUT type=submit value=Ping ID="Submit1" NAME="Submit1"> 
<br> <PRE><asp:Literal id=PingResults Runat="server"></asp:Literal></PRE> 

    </form>

  </body>
</HTML>


 

[VB.NET]

<%@ Page Language="vb" %>
<%@ Import Namespace="aspNetPing"%>
<HTML>
  <HEAD>
    <title>pingme</title>
<script runat=server>
    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
		If Page.IsPostBack Then 
			Dim hostToPing As String = txtHost.Value 
			Dim reply As ReplyPacketCollection = IcmpClient.Ping(hostToPing, 4) 
			PingResults.Text = reply.ToString() 
		End If 
    End Sub

</script>
</HEAD>
  <body >

    <form id="Form1" method="post" runat="server">  
<INPUT id=txtHost type=text runat="server" NAME="txtHost"><INPUT type=submit value=Ping ID="Submit1" NAME="Submit1"> 
<br> <PRE><asp:Literal id=PingResults Runat="server"></asp:Literal></PRE> 

    </form>

  </body>
</HTML>

 

4. Save this file as pingme.aspx and upload it to your web application.
 

5. Open Internet Explorer (or a suitable web browser) and navigate it to your website and view the pingme.aspx (for example http://localhost/pingme.aspx ).

6. Enter an IP or a host (such as www.yahoo.com )the textbox. Click Pingand aspNetPing will ping the host.   You should see similar results to those below:

 

EchoReply from 216.109.125.64: seq: 1 bytes=32 time=81ms TTL=49
EchoReply from 216.109.125.64: seq: 2 bytes=32 time=90ms TTL=49
EchoReply from 216.109.125.64: seq: 3 bytes=32 time=90ms TTL=49
EchoReply from 216.109.125.64: seq: 4 bytes=32 time=90ms TTL=49

Ping statistics for:
	Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
	Minimum = 81ms, Maximum = 90ms, Average = 87ms

Summary

That's all there is to using aspNetPing from a Non - Visual Studio .NET environment.



The box is not shipped. aspNetPing is a downloadable product.