ASP.NET C# - Find a machine name using IP Address

Collapse
X
 
  • Time
  • Show
Clear All
new posts

  • Smurfas
    replied
    Nobody have Idias? :[

    Leave a comment:


  • Smurfas
    replied
    I have parallel question.

    I use this, when i found Computer name:

    String IP = "127.0.0.1" ;
    String Vardas = System.Net.Dns. GetHostEntry(IP ).HostName;

    How in this function put My made-up IP Address?(I don't wont found IP automation) :

    string name = Page.User.Ident ity.Name;
    name = name.Substring( name.IndexOf(@" \") + 1);

    I hop understant my question.
    I wont like this:
    string name = Page.User.Ident ity(IP).Name; - but don't work. How make, what this work

    Leave a comment:


  • DrBunchman
    replied
    The above method will probably only work if you have a DNS Server. Do you?

    Leave a comment:


  • Smurfas
    replied
    Originally posted by DrBunchman
    Is your friend on your local network? The method above works by retrieving the machine name from the DNS not from the machine itself.

    Dr B
    Yes, hi in local network

    Leave a comment:


  • DrBunchman
    replied
    Is your friend on your local network? The method above works by retrieving the machine name from the DNS not from the machine itself.

    Dr B

    Leave a comment:


  • Smurfas
    replied
    "PS Please post ASP.NET questions in the .NET Forum. The ASP Forum is for Classic ASP only." - Sorry


    String sComp = System.Net.Dns. GetHostEntry("1 27.0.0.2").Host Name;
    Label1.Text = sComp;

    But when i Put My friend IP adresas, then show only this: 127.0.0.2
    Don't see computer name.

    When I put my IP adress 127.0.0.1, i see My computer name:
    Dzimbo-B9646K9\Dzimbo

    Leave a comment:


  • DrBunchman
    replied
    Hi Smurfas,

    When you request server variables you are getting information about the user that is logged on to the server. I'm guessing that you are using ASP.NET in which case you can use the following code to retrieve a computer name from the DNS when you know the IP address:
    Code:
     
    string sComp = System.Net.Dns.GetHostEntry("127.0.0.1").HostName;
    Hope this helps,

    Dr B

    PS Please post ASP.NET questions in the .NET Forum. The ASP Forum is for Classic ASP only.

    Leave a comment:


  • Smurfas
    started a topic ASP.NET C# - Find a machine name using IP Address

    ASP.NET C# - Find a machine name using IP Address

    Hi, everything simple:
    Code:
    string strWhatever = Request.ServerVariables("LOGON_USER");
    TextBox1.Text = strWhatever;
    Found, my Computer name.
    But how found another computer name, when I have IP.
    Some like that:

    Code:
    string strWhatever = Request.ServerVariables("LOGON_USER") = 123.123.123.123
    TextBox1.Text = strWhatever;
    How make, what this work.

    I hope, you get wath i need.
Working...