Just wondering if there is any way to get the NS records in C#. I have read on the MSDN and there seems to be a DNS class that can return the host IP address. However, I am after the NS record type.
Many thanks
As I recall, this functionality is not built in to C#.
However, there are some no-license and open-source-license components that will provide much richer DNS functionality.
Check this link for one. Others are easy to find with Google/Bing.
You could use SimpleDNS which provides results for Query Types A , CName , MX , NS , SOA and TXT .
//Create your question - (Hostname,QueryType)
var question = new Question("stackoverflow.com", QType.NS);
//Create your SimpleDnsPacket and pass to the Util method Kitson.Dns.Query
var result = Query.Simple(new SimpleDnsPacket(question, IPAddress.Parse("8.8.8.8")));
Result:
It's also available as Nuget package and compatible with .NetCore 2.0.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.