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. .NET (Core and Framework)
  4. Reverse IP Lookup in C#/.NET

Reverse IP Lookup in C#/.NET

Scheduled Pinned Locked Moved .NET (Core and Framework)
csharpquestiondotnettutorial
3 Posts 3 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.
  • Q Offline
    Q Offline
    Quimbly
    wrote on last edited by
    #1

    I'm developing a firewall log monitoring application in C# with the .NET framework, and I can't figure out something. I'm trying to do a reverse lookup on an IP address. I don't mean reverse lookup to a DNS entry. I'm looking to find out the computer-name behind the IP address. The only thing I can find that's remotely related is: Dns.GetHostByName() and Dns.GetHostByAddress(). However,these methods deal with IPHost objects, which only contain DNS or IP information -- nothing about computer- name. Does anyone have any idea how to get a computer-name from an IP address in my C#/.NET application? Is there anything in .NET that will accomplish this? If so, what is it? If not, what can I call outside of .NET that I can incorporate into my application? Thanks!

    P V 2 Replies Last reply
    0
    • Q Quimbly

      I'm developing a firewall log monitoring application in C# with the .NET framework, and I can't figure out something. I'm trying to do a reverse lookup on an IP address. I don't mean reverse lookup to a DNS entry. I'm looking to find out the computer-name behind the IP address. The only thing I can find that's remotely related is: Dns.GetHostByName() and Dns.GetHostByAddress(). However,these methods deal with IPHost objects, which only contain DNS or IP information -- nothing about computer- name. Does anyone have any idea how to get a computer-name from an IP address in my C#/.NET application? Is there anything in .NET that will accomplish this? If so, what is it? If not, what can I call outside of .NET that I can incorporate into my application? Thanks!

      P Offline
      P Offline
      Philip Fitzsimons
      wrote on last edited by
      #2

      machine name=host name. this an IP protocol, not a windows one....


      "When the only tool you have is a hammer, a sore thumb you will have."

      1 Reply Last reply
      0
      • Q Quimbly

        I'm developing a firewall log monitoring application in C# with the .NET framework, and I can't figure out something. I'm trying to do a reverse lookup on an IP address. I don't mean reverse lookup to a DNS entry. I'm looking to find out the computer-name behind the IP address. The only thing I can find that's remotely related is: Dns.GetHostByName() and Dns.GetHostByAddress(). However,these methods deal with IPHost objects, which only contain DNS or IP information -- nothing about computer- name. Does anyone have any idea how to get a computer-name from an IP address in my C#/.NET application? Is there anything in .NET that will accomplish this? If so, what is it? If not, what can I call outside of .NET that I can incorporate into my application? Thanks!

        V Offline
        V Offline
        Vasudevan Deepak Kumar
        wrote on last edited by
        #3

        I think the following on an ASP.NET or its associated codebehind page should solve your problem: string userip = Request.ServerVariables["REMOTE_ADDR"].ToString(); string workstationname = System.Net.Dns.Resolve(userip).HostName.ToString(); The name of the machine accessing the webserver should be contained in the workstationname. However the firewall might put its name over there. We are currently using a proxy called 'Squid Cache' and I observed the following type of header contains the IP Address of the client machine (that is mine), which is behind the proxy/firewall. HTTP_X_FORWARDED_FOR But the name of the machine behind the proxy might need a workaround though. Deepak Kumar Vasudevan

        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