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


Product List
 
  "[aspNetEmail] is so simple and trouble free, that it seems there is little to say about it - but I guess that says a lot. It is very easy to learn/use and just works!"
Jim Duncan
PCC Nurses Agency
 
More
Testimonies

Summary

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

 

Instructions
Using Visual Studio .NET (VS.NET ) You will create a single webform (lookup.aspx) that allows users to trace a route to a host. lookup.aspx will use aspNetWhois 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 C# Projects. Under Templates, select ASP.NET Web Application. In the Location textbox, enter http://localhost/aspNetWhoisTest

 

Setting the Reference to aspNetWhois.
There are two ways to set a reference in VS.NET . Because aspNetWhois is installed in the GAC (Global Assembly Cache) you can set a reference to the GAC copy, or you can import the aspNetDns.dll to the project and set a reference to the imported copy. We will upload a copy, and set a reference to the imported copy. This method will promote XCOPY deployment. (A comment about licensing: Please be sure you are compliant with your licenses. Check http://www.aspNetWhois.com/licen.aspx for more information.)

1. In the Solution Explorer, right-click the project name, aspNetWhoisTest, 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 install directory. By default, this directory is C:\Program Files\AdvancedIntellect\aspNetDns. 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 aspNetWhoisTest 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 aspNetWhois.

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

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

2. lookup.aspx loads in the designer window. Select the View | Html Source menu command. The html code of lookup.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=Lookup ID="Submit1" NAME="Submit1"> 
<br><PRE><asp:Literal id=WhoisResults Runat="server"></asp:Literal>

 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 lookup.aspx, and select View Code.

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

	Imports aspNetWhois

 

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 WhoisResults 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

            WhoisResults.Text = Whois.QueryNow("whois.networksolutions.com", txtHost.Value)

        End If
    End Sub

This code first checks to see if the page was posted.  If the page was posted, the whois query is made using the the static method Whois.QueryNow(). The results are written to the literal tag.

 

Testing The Page
Lets compile and test the page.

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

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

3. Enter a domain, such as microsoft.com in the textbox. Click  Lookupand aspNetWhois will perform a whois lookup.   You should see similar results to those below:

 

NOTICE AND TERMS OF USE: You are not authorized to access or query our WHOIS
database through the use of high-volume, automated, electronic processes. The
Data in VeriSign's WHOIS database is provided by VeriSign for information
purposes only, and to assist persons in obtaining information about or related
to a domain name registration record. VeriSign does not guarantee its accuracy.
By submitting a WHOIS query, you agree to abide by the following terms of use:
You agree that you may use this Data only for lawful purposes and that under no
circumstances will you use this Data to: (1) allow, enable, or otherwise support
the transmission of mass unsolicited, commercial advertising or solicitations
via e-mail, telephone, or facsimile; or (2) enable high volume, automated,
electronic processes that apply to VeriSign (or its computer systems). The
compilation, repackaging, dissemination or other use of this Data is expressly
prohibited without the prior written consent of VeriSign. You agree not to use
high-volume, automated, electronic processes to access or query the WHOIS
database. VeriSign reserves the right to terminate your access to the WHOIS
database in its sole discretion, including without limitation, for excessive
querying of the WHOIS database or for failure to otherwise abide by this policy.
VeriSign reserves the right to modify these terms at any time.


Registrant:
Microsoft Corporation (MICROSOFT-DOM)
   1 microsoft way
   redmond, WA 98052
   US

   Domain Name: MICROSOFT.COM

   Administrative Contact:
      Microsoft Corp  (EPMKOEAUSO)		msnhst@MICROSOFT.COM
      Microsoft Corp
      One Microsoft Way
      Redmond, WA 98052
      US
      425 882 8080
   Technical Contact:
      Microsoft  (EJSEHEQUAO)		msnhst@MICROSOFT.COM
      Microsoft
      One Microsoft Way
      Redmond, WA 98052
      US
      425-882-8080

   Record expires on 03-May-2012.
   Record created on 02-May-1991.
   Database last updated on 14-May-2003 16:50:26 EDT.

   Domain servers in listed order:

   DNS1.CP.MSFT.NET             207.46.138.20
   DNS3.UK.MSFT.NET             213.199.144.151
   DNS1.SJ.MSFT.NET             65.54.248.222
   DNS1.DC.MSFT.NET             64.4.25.30
   DNS1.TK.MSFT.NET             207.46.245.230

Summary
That's all there is to using aspNetWhois from Visual Studio .NET. In these few simple steps you were able to create a project, set a reference to aspNetWhois, and perform a lookup. 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. aspNetWhois is a downloadable product.