2

Using C# 4.5, how can I find an authoritative DNS server for a given URL (ideally asynchronously) and then ensure that subsequent queries (i.e. from HttpClient) against that URL will be served from that DNS server and not a downstream cache?

Alex
  • 75,813
  • 86
  • 255
  • 348
  • 1
    The [Dns Class](http://msdn.microsoft.com/en-us/library/system.net.dns.aspx) doesn't offer many configuration options. So the answer is likely: implement a DNS client yourself or look for a third-party library that does what you need. – dtb Dec 19 '12 at 07:49
  • I assume you have a good reason for doing this, because DNS is designed to cache aggressively for a variety of reasons. It might suffice to just do a bit of bit-twiddling and put the UDP packets together yourself, DNS queries aren't too complex. – Matt Patenaude Dec 19 '12 at 07:50
  • 1
    [This](http://stackoverflow.com/a/1778680/674700) might help for the first part. – Alex Filipovici Dec 19 '12 at 07:51
  • ... And possibly for the second (untested): _Optionally specify which DNS servers to query (default = DNS servers from local system config)._ – Alex Filipovici Dec 19 '12 at 07:57

0 Answers0