0

We can get the IP Address by Dns.GetHostEntry from domain name, and it's resolve by the default DNS from my computer. Now I wanna resolve by other DNS like 8.8.8.8 , how can I do in C#?

Hy.Lim
  • 1

2 Answers2

1

.Net framework doesn't have built in support for resolving DNS by specifying a specific DNS server.. You'd have to write your own custom code, probably around some win32 API like DnsQueryEx to get what you want.

Vikas Gupta
  • 4,455
  • 1
  • 20
  • 40
0

You can also launch nslookup programmatically and capture and parse its output Capturing nslookup shell output with C#

The command you use will be

nslookup host-to-look-up 8.8.8.8
Community
  • 1
  • 1
Vince
  • 620
  • 1
  • 5
  • 9