Hy.Lim
Hy.Lim

Reputation: 1

How to Get IP Address by Other DNS in C#?

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#?

Upvotes: 0

Views: 239

Answers (2)

Vince
Vince

Reputation: 650

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

Upvotes: 0

Vikas Gupta
Vikas Gupta

Reputation: 4465

.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.

Upvotes: 1

Related Questions