gavinjoyce Posted February 18, 2003 Posted February 18, 2003 Hi, When I use Dsn.Resolve, what DNS server IP is it using? Is it possible to get this IP? Thanks, Gavin Quote
gavinjoyce Posted February 18, 2003 Author Posted February 18, 2003 Just to clarify - I am looking to get the primary DNS server that the current mahine is using. Quote
*Gurus* Derek Stone Posted February 18, 2003 *Gurus* Posted February 18, 2003 The domain name system works my moving up a chain of DNS servers one-by-one, until the domain-to-IP mapping entry being looked for is found. Usually this process starts off at your ISP, and works it way towards the 13 (don't quote me on that exact number) root DNS servers run by UUNET and other large providers. You can determine the DNS servers that your computer primarily uses by typing the following at a command prompt: ipconfig /all Getting this information in .NET is a different story though. Other than an unmanaged solution I believe you're out of luck. Quote Posting Guidelines
gavinjoyce Posted February 18, 2003 Author Posted February 18, 2003 Thanks, are the root server IP at UUNET static? I would like to hard-code them into my component as the default DSN servers. Quote
gavinjoyce Posted February 18, 2003 Author Posted February 18, 2003 ok, I found them here -> http://www.windows-expert.net/Common/en/Articles/Configure-Windows-DNS-for-Internet-Access.asp They are: 202.12.27.33 198.32.64.12 193.0.14.129 198.41.0.10 192.36.148.17 128.63.2.53 192.112.36.4 192.5.5.241 192.203.230.10 128.8.10.90 192.33.4.12 128.9.0.107 198.41.0.4 Quote
*Gurus* divil Posted February 18, 2003 *Gurus* Posted February 18, 2003 This sounds like a bad idea to me - why would you hardcode those? The whole point of DNS is that it should be automatic, traversing a tree to get the desired result, as Derek said. Quote MVP, Visual Developer - .NET Now you see why evil will always triumph - because good is dumb. My free .NET Windows Forms Controls and Articles
gavinjoyce Posted February 18, 2003 Author Posted February 18, 2003 I dont want to hard code these, but I do need to solve the problem (ie. I need to have a DNS ip at runtime). If I can get the machine's Primary DNS IP that would be ideal, but failing that I will use these. I plan to allow the user to override these. Any further help would be much appreciated Quote
*Gurus* Derek Stone Posted February 19, 2003 *Gurus* Posted February 19, 2003 I think the question that both Divil and I have is why you would need a DNS server IP in the first place. Care to enlighten us? Quote Posting Guidelines
gavinjoyce Posted February 19, 2003 Author Posted February 19, 2003 Sure, I am writing a email validation component which validates the addresses by chatting with the mail server. I need a DNS IP so that I can get the email server's mx record. Quote
*Gurus* Derek Stone Posted February 19, 2003 *Gurus* Posted February 19, 2003 I'm positive there's a way to do this using WSALookupServiceBegin/Next however my mind is drawing a blank. Have a look into those two functions and let me know if you find anything, as I just don't have the time. Also, while I don't consider this a perfect solution, you can locate the DNS server IPs under HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces\{guid}\ You'd be looking for values named "NameServer", however that value is not present under all of the contained keys. Quote Posting Guidelines
gavinjoyce Posted February 25, 2003 Author Posted February 25, 2003 Thanks for all your help. I have released the component - dotNetMX. You can view it in action - http://www.dotnetmx.com/ As a thank you to everyone on this forum who helped, I would like to offer you all a free license for this. Just email me in the next week and I will forward you a copy. (It retails for $25). Thanks, Gavin Joyce http://www.gavinjoyce.com gavin@gavinjoyce.comNOSPAM Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.