The aspNetDns namespace contains the DnsQuery object and the DnsQueryTypes. The DnsQuery object is an object that will allow you generically query any DNS record or class. The DnsQuery object requires a type from DnsQueryTypes and will return the Resource Record object, the base class for all DNS Records.
The aspNetDns.Records namespace contains all of the Resource Records classes. Some of these classes include Address (A) Records, CanonicalName (CName) Records, Start of Authority (SOA) Records, Mail Exchange (MX) Records, and many more. These classes also contain the static, or shared, methods that allow you to query DNS servers with one line of code.
aspNetDns also support asynchronous programming through the use of callbacks. All record classes can be called asynchronously to retrieve records. aspNetDns transparently passes all operation to a background thread, and immediately continues executing your code, on the primary thread. Once the background thread has finished querying records, aspNetDns will execute the callback functions specified when the asynchronous operation first started. A listing of sample asynchronous calls can be found below.
The following examples demonstrate using the aspNetDns namespace, along with the aspNetDns.Records namespace.
Querying Address Records
A simple query for Address records
Querying MX Records
A simple query for MX Records
Querying Canonical (CName)
Name Records
A simple query for CName or alias records.
Performing a Reverse Lookup
using Pointer Records
Performing a Reverse lookup on an IP Address
Querying Start of Authority Records
Querying for Start of Authority Records for a given domain.
Using Failover DNS Servers
Use multiple DNS servers for failover functionality.
Querying Address Records
A simple query for Address records.
Querying MX Records
A simple query for MX records.
Performing a Reverse Lookup using Pointer
Records
Perform a reverse lookup on an IP Address.
Querying Start of Authority Records
Query a domain for Start of Authority records.
Asynchronously query Address
Records
A simple asynchronous query for Address records.
Asynchronously query MX Records
A simple asynchronous query for Mail (MX) Exchange records.
Asynchronously perform a Reverse Lookup
A simple asynchronous reverse lookup of an IP Address using pointer records.