R – Clearing/Editing Internet explorer DNS cache

asp.netcachinginternet explorer

I am using internet IE 7, IE 8

My application in running in dns fail over environment with primary and back up server. As the primary server is down, failover changes to the secondary server after 2 – 3 minutes.

But the problem is, the current opened page in IE is still sending requests to the primary server due to dns caching, which stores the IP of the primary server for default 30 minutes) and hanged.

This problem can be solved if we can clear or edit the dns cache with C# ASP.Net coding.

Thanks in advance for replying.

Best Answer

You cannot access a client machine's DNS Cache from your ASP.NET server or anything in the browser. It would be a huge security hole to either of those environments to do so.

The better approach if you're looking for DNS failover is to talk to your network administrator. Ask him/her to set the TTL for your DNS records to a number smaller than your failover time. This will increase the frequency with which the client machines refresh their caches (for your site only) and shorten their downtime in the event of a failover.

The negligible drawback is that it can increase (ever so slightly) their wait time for the site because they have to do DNS requests more often.