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


Product List
 
  "Thank you ! This is exactly what I needed. Our company will be purchasing the product today...probably Site License."
J.M
 
More
Testimonies

VS.NET and VB.NET

 

Summary

The following article will describe how to use aspNetTraceRoute from Visual Studio .NET using VB.NET. This brief tutorial assumes you have IIS installed locally on your machine, and have downloaded and installed aspNetTraceRoute from www.aspNetTraceRoute.com . For an updated version of this article, visit www.aspNetTraceRoute.com/examples.aspx 

 

Instructions
Using Visual Studio .NET (VS.NET ) You will create a single webform (TraceMe.aspx) that allows users to trace a route to a host. TraceMe.aspx will use aspNetTraceRoute to create an ICMP packet.

1. Launch Visual Studio .NET

2. From the main menu, select the File | New | Project command.

3. The New Project dialog box appears. Under Project Types, Select Visual Basic Projects. Under Templates, select ASP.NET Web Application. In the Location textbox, enter http://localhost/aspNetTraceRouteTest

 

Setting the Reference to aspNetTraceRoute.

1. In the Solution Explorer, right-click the project name, aspNetTraceRouteTest, and select the Add | Add Existing Item command.

2. The Add Existing Item dialog box appears. Under Files of Type, select All Files(*.*). Navigate to the aspNetDns.dll. Double-click the aspNetDns.dll. The Add Existing Item dialog box closes, and the aspNetDns.dll was imported to the root directory of your project.

3. In the Solution Explorer, right-click the project name aspNetTraceRouteTest and select Add Reference. The Add Reference dialog box appears. Click the Browse button. The Select Component dialog box appears. Double-click the aspNetDns.dll file. The Select Component dialog box closes. Click OK. The Add Reference dialog box closes, and a reference is set to aspNetTraceRoute.

Create a Test Page.
Now that we have a reference set, let's create TraceMe.aspx to use aspNetTraceRoute.

1. In the Solution Explorer, right-click the project name aspNetTraceRouteTest, and select Add | Add Webform. The Add New Item dialog box appears. In the Name textbox, enter, TraceMe.aspx.

2. TraceMe.aspx loads in the designer window. Select the View | Html Source menu command. The html code of TraceMe.aspx appears. Between the opening and closing form tags add the following html

 

<INPUT id=txtHost type=text runat="server" NAME="txtHost"><INPUT type=submit value=Trace ID="Submit1" NAME="Submit1"> 
<br> <PRE><asp:Literal id=TraceResults  Runat="server"></asp:Literal></PRE> 

	

 This code will create a html text box, a submit button, and a <asp:literal> tag that we will use for writing out our results.

3. In the Solution Explorer, right-click TraceMe.aspx, and select View Code.

4. Add the following Imports statement to the top of the page.

	Imports aspNetTraceRoute;

 

5. Be sure the following two lines of code to wire up the TextBox and <asp:Literal> are available at the class level.

    Protected WithEvents TraceResults As System.Web.UI.WebControls.Literal
    Protected WithEvents txtHost As System.Web.UI.HtmlControls.HtmlInputText

6. To the Page_Load method, add the following code.

    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        If Page.IsPostBack Then
            Dim results As TraceRouteReplyCollection = TraceRouteClient.Trace(txtHost.Value, 30, True)
            TraceResults.Text = results.ToString()
        End If

    End Sub

This code first checks to see if the page was posted.  If the page was posted, the host is pinged the static method TraceRouteClient.Trace. The results are written to the literal tag by calling results.ToString(). ToString() specifically formats the TraceRoute results.

 

Testing The Page
Lets compile and test the page.

1. In the Solution Explorer, right-click the project name, aspNetTraceRouteTest, and select Build. The project will be compiled.

2. In the Solution Explorer, right-click traceme.aspx and select View in Browser.

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

 

0 40ms 43ms 50ms rt3-sc-psci.psci.net [63.65.189.67]
1 40ms 47ms 51ms rt3-sc-psci.psci.net [63.65.189.67]
2 40ms 46ms 50ms rt1-sc-psci.psci.net [63.65.189.65]
3 50ms 56ms 60ms Serial0-1-0.GW1.IND1.ALTER.NET [157.130.104.197]
4 50ms 56ms 60ms 121.at-2-1-0.XR2.CHI4.ALTER.NET [152.63.65.134]
5 60ms 63ms 70ms 194.at-1-0-0.XR2.CHI2.ALTER.NET [152.63.65.1]
6 60ms 60ms 60ms 0.so-2-1-0.XL2.CHI2.ALTER.NET [152.63.67.133]
7 60ms 60ms 61ms 0.so-7-1-0.BR6.CHI2.ALTER.NET [152.63.64.57]
8 60ms 60ms 60ms bpr1-so-6-0-0.ChicagoEquinix.cw.net [208.174.226.1]
9 60ms 60ms 61ms dcr2-so-4-3-0.Chicago.cw.net [208.175.10.237]
10 80ms 86ms 100ms dcr2-loopback.Washington.cw.net [206.24.226.100]
11 80ms 80ms 80ms bhr1-pos-10-0.Sterling1dc2.cw.net [206.24.238.166]
12 71ms 77ms 80ms csr12-ve241.Sterling2dc3.cw.net [216.109.66.91]
13 80ms 80ms 80ms 216.109.84.166
14 80ms 83ms 90ms vl33.bas2-m.dcn.yahoo.com [216.109.120.154]
15 80ms 80ms 81ms w19.www.dcn.yahoo.com [216.109.125.72]

Summary
That's all there is to using aspNetTraceRoute from Visual Studio .NET. In these few simple steps you were able to create a project, set a reference to aspNetTraceRoute, and trace a route to a remote host. For more questions or comments, feel free to write support@advancedIntellect.com

Complete Source Code Listing
The entire source listing can be found here.



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