The following example demonstrates querying Pointer records, also known as
performing a reverse lookup.
[C#]
using System;
using aspNetDns;
using aspNetDns.Records;
namespace ConsoleApplication1
{
class Class1
{
[STAThread]
static void Main(string[] args)
{
DnsQuery dns = new DnsQuery();
string LookupRecord = "207.46.134.222";
ResourceRecord[] records = dns.GetDnsRecords( DnsQueryType.PTR, LookupRecord );
if( records.Length > 0 )
{
for( int i=0;i<records.Length;i++)
{
Console.WriteLine( "Pointer Record: " + records[i].AnswerString );
}
}
else
{
Console.WriteLine( "No Pointer records were found.");
}
Console.WriteLine( "done.");
Console.ReadLine();
}
}
}
[VB.NET]
Imports aspNetDns
Imports aspNetDns.Records
Module Module1
Sub Main(ByVal args() As String)
Dim dns As New DnsQuery()
Dim LookupRecord As String = "207.46.134.222"
Dim records As ResourceRecord() = dns.GetDnsRecords(DnsQueryType.PTR, LookupRecord)
If records.Length > 0 Then
Dim i As Integer
For i = 0 To records.Length - 1
Console.WriteLine("Pointer Record: " + records(i).AnswerString)
Next i
Else
Console.WriteLine("No Pointer records were found.")
End If
Console.WriteLine("done.")
Console.ReadLine()
End Sub 'Main
End Module