Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. DNS Resolve problem in .NET 2.0???

DNS Resolve problem in .NET 2.0???

Scheduled Pinned Locked Moved C#
csharpsysadminhelpquestion
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    gman44
    wrote on last edited by
    #1

    I can type an IP address and receive Internet domain name and my workstation name however no other IPs of computers on our internal network will resolve to a thier machine name only to the same IP that is entered. What's up Microsoft???? I can say that before we switched over .NET 1.1 to 2.0 the Dns.Resolve(entry); would find a name for any IP, LAN or WAN. Q. Any ideas?????????? [This is new .NET 2.0 method that replaced the former .Resolve method] private void LookupIP(string entry) { try { IPHostEntry IP = Dns.GetHostEntry(entry); txtBox2.Text = IP.HostName; } catch(Exception exception) {

    S 1 Reply Last reply
    0
    • G gman44

      I can type an IP address and receive Internet domain name and my workstation name however no other IPs of computers on our internal network will resolve to a thier machine name only to the same IP that is entered. What's up Microsoft???? I can say that before we switched over .NET 1.1 to 2.0 the Dns.Resolve(entry); would find a name for any IP, LAN or WAN. Q. Any ideas?????????? [This is new .NET 2.0 method that replaced the former .Resolve method] private void LookupIP(string entry) { try { IPHostEntry IP = Dns.GetHostEntry(entry); txtBox2.Text = IP.HostName; } catch(Exception exception) {

      S Offline
      S Offline
      spirit_of_pak
      wrote on last edited by
      #2

      hi, the following three lines are working for me & successfully resolves an IP to hostname.you are probably missing the second line i.e you are not parsing the string to an IPAddress. IPAddress ipis; ipis = IPAddress.Parse(address); string hostname = Dns.GetHostEntry(ipis).HostName; try this and then see what happens.

      G 1 Reply Last reply
      0
      • S spirit_of_pak

        hi, the following three lines are working for me & successfully resolves an IP to hostname.you are probably missing the second line i.e you are not parsing the string to an IPAddress. IPAddress ipis; ipis = IPAddress.Parse(address); string hostname = Dns.GetHostEntry(ipis).HostName; try this and then see what happens.

        G Offline
        G Offline
        gman44
        wrote on last edited by
        #3

        No didn't work for me either. Be sure your workstation is: a. Windows XP Pro (sp 2) b. VS2005 .NET c. .NET 2.0 So far I'm using the GetHostByAddress method, although I recieve a 'yellow' warning during the compile, it does still compile and not halt in error like the Resolve method does now since .NET 2.0. The program will open and run as usual. However, I would like a flawless code like before the .Resolve obsolecsence. string hostname = System.Net.Dns.GetHostByAddress(IPAddress.Parse(entry)).HostName;

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups