Reading NS records in C# using ARSoft packages
In this post you will learn about reading NS records in C# using ARSoft packages. This package is handy to read domain NS records. Here's a sample code which will help:
using System;
using System.Linq;
using ARSoft.Tools.Net;
using ARSoft.Tools.Net.Dns;
namespace ConsoleApp14
{
class Program
{
static void Main(string[] args)
{
var dnsMessage = DnsClient.Default.Resolve(DomainName.Parse("learninhindi.com"), RecordType.Ns);
var nsrecords = dnsMessage.AnswerRecords.OfType<NsRecord>();
foreach (var record in nsrecords)
{
Console.WriteLine(record.NameServer.ToString().TrimEnd('.'));
}
Console.ReadKey();
}
}
}
Here's the output of the above code:
Hope this helps.
amit.ns.cloudflare.com
fiona.ns.cloudflare.com
Hope this helps.
Comments
Post a Comment