Specify which DNS servers to use to resolve hostnames in .NET

前端 未结 4 1193
野性不改
野性不改 2020-12-09 10:46

I\'d like to know if there\'s any way to force the System.Net.Dns class to resolve hostnames using a set of custom DNS servers instead of using the ones that are associated

4条回答
  •  春和景丽
    2020-12-09 11:35

    No this cannot be done with the .Net Framework. The Dns.Resolve method relies on the internal Win32 APIs which in turn go through the DNS servers associated with the network connection.

    In order to get this to work, you'd have to change the DNS servers associated with the network adapter's address.

提交回复
热议问题