Query Records using the AddressRecord  class.

The following example demonstrates querying Address records using the static method called GetAddressRecords().

[C#]

using System;
using aspNetDns;
using aspNetDns.Records;
namespace ConsoleApplication1
{
	class Class1
	{
		[STAThread]
		static void Main(string[] args)
		{

			string LookupRecord = "microsoft.com";
			AddressRecord[] records = AddressRecord.GetAddressRecords( LookupRecord );

			if( records.Length > 0 )
			{
				for( int i=0;i<records.Length;i++)
				{
					Console.WriteLine( "Address Record: " + records[i].IP.ToString() );
				}

			}
			else
			{
				Console.WriteLine( "No address records were found.");
			}


			Console.WriteLine( "done.");
			Console.ReadLine();
		}
	}
}






 

[VB.NET]

Imports aspNetDns
Imports aspNetDns.Records
Module Module1

    Sub Main(ByVal args() As String)

        Dim LookupRecord As String = "microsoft.com"
        Dim records As AddressRecord() = AddressRecord.GetAddressRecords(LookupRecord)
        If records.Length > 0 Then
            Dim i As Integer
            For i = 0 To records.Length - 1
                Console.WriteLine("Address Record: " + records(i).IP.ToString())
            Next i

        Else
            Console.WriteLine("No address records were found.")
        End If

        Console.WriteLine("done.")
        Console.ReadLine()

    End Sub 'Main

End Module