title: Resetting DNS cache in C# + Mono
body: <p>I'm developing a software with <strong>C#</strong> + <strong>Mono</strong> in <strong>Ubuntu</strong> which makes use of network classes like <code>WebRequest</code> or <code>Dns</code>. During development phase, I used my code to connect to a local webserver <code>192.168.1.101</code> and after a while I had to move it to <code>102.168.1.20</code>, and I used a local DNS server giving the mentioned IPs readable names (to simulate the real world scenario). But now, no matter what I do, I can not connect to the new server in my C# code! Here are things as they are:</p>
  
  <ul>
  <li><p><code>$ ping myurl.local</code> => 192.168.1.20</p></li>
  <li><p><code>$ nslookup myurl.local</code> => 192.168.1.20</p></li>
  <li><p>Log from my code: <code>Dns.GetHostAddresses("myurl.local")[0].ToString()</code> => 192.168.1.101</p></li>
  </ul>
  
  <p>It seems to me that Mono has cached the DNS' resolved results from before and it won't let go of them. So I searched the Internet for it and I found <a href="https://stackoverflow.com/questions/7277582/how-do-i-clear-system-net-client-dns-cache">this question</a>. It has the same problem as mine but in Windows and .Net and also a solution. Unfortunately, its solution does not apply to mine, since <code>ServicePointManager.DnsRefreshTimeout</code> <a href="https://stackoverflow.com/questions/15643223/dns-refresh-timeout-with-mono">is not implemented in Mono</a>! The worst part is that the cache is persistent even if I restart the software and/or hardware thus I'm unable to proceed with my development!</p>
  
  <p>So I wonder if there is a way I can reset Mono's cache, other than using <code>DnsRefreshTimeout</code>? Even a manual solution will do for now (something I can do in shell!? Like removing a file perhaps!?).</p>
  
  <p>I'm using <strong>Ubuntu 12.04</strong> and <strong>Mono 3.2.3</strong>.</p>