How do I clear System.Net client DNS cache?

I finally dug up the obscure command from MSDN that fixes this:

ServicePointManager.DnsRefreshTimeout = 0;

As I unwound all the weird things I’d tried previously, I discovered one other setting that I need along with the one above; on the request object, turn off keep-alive:

request.KeepAlive = false;

Leave a Comment