Here are some simple examples for using aspNetDns
[ C# ]
using System; using aspNetDns; using aspNetDns.Records; string LookupRecord = "microsoft.com"; DnsQuery dns = new DnsQuery(); ResourceRecord[] records = dns.GetDnsRecords( DnsQueryType.A, LookupRecord ); if( records.Length > 0 ) { foreach( ResourceRecord r in records ) { Console.WriteLine( r.AnswerString ); } } else { Console.WriteLine( "no address records exist for " + LookupRecord ); }
[ Visual Basic ]
Imports aspNetDns Imports aspNetDns.Records Dim LookupRecord As String = "microsoft.com" Dim dns As New DnsQuery() Dim records As ResourceRecord() = dns.GetDnsRecords(DnsQueryType.A, LookupRecord) If records.Length > 0 Then Dim r As ResourceRecord For Each r In records Console.WriteLine(r.AnswerString) Next r Else Console.WriteLine(("no address records exist for " + LookupRecord)) End If
Copyright 2002 - Contact: Webmaster Last Updated: Wednesday, April 30, 2008