ASP.NET C# - Find a machine name using IP Address
Collapse
X
-
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 workLeave a comment:
-
The above method will probably only work if you have a DNS Server. Do you?Leave a comment:
-
Yes, hi in local networkOriginally posted by DrBunchmanIs your friend on your local network? The method above works by retrieving the machine name from the DNS not from the machine itself.
Dr BLeave a comment:
-
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 BLeave a comment:
-
"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\DzimboLeave a comment:
-
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:
Hope this helps,Code:string sComp = System.Net.Dns.GetHostEntry("127.0.0.1").HostName;
Dr B
PS Please post ASP.NET questions in the .NET Forum. The ASP Forum is for Classic ASP only.Leave a comment:
-
ASP.NET C# - Find a machine name using IP Address
Hi, everything simple:
Found, my Computer name.Code:string strWhatever = Request.ServerVariables("LOGON_USER"); TextBox1.Text = strWhatever;
But how found another computer name, when I have IP.
Some like that:
How make, what this work.Code:string strWhatever = Request.ServerVariables("LOGON_USER") = 123.123.123.123 TextBox1.Text = strWhatever;
I hope, you get wath i need.Tags: None
Leave a comment: