473,396 Members | 1,809 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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

30
Hi, everything simple:
Expand|Select|Wrap|Line Numbers
  1. string strWhatever = Request.ServerVariables("LOGON_USER");
  2. TextBox1.Text = strWhatever;
  3.  
Found, my Computer name.
But how found another computer name, when I have IP.
Some like that:

Expand|Select|Wrap|Line Numbers
  1. string strWhatever = Request.ServerVariables("LOGON_USER") = 123.123.123.123
  2. TextBox1.Text = strWhatever;
  3.  
How make, what this work.

I hope, you get wath i need.
Jul 20 '08 #1
7 18047
DrBunchman
979 Expert 512MB
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:
Expand|Select|Wrap|Line Numbers
  1.  
  2. string sComp = System.Net.Dns.GetHostEntry("127.0.0.1").HostName;
  3.  
Hope this helps,

Dr B

PS Please post ASP.NET questions in the .NET Forum. The ASP Forum is for Classic ASP only.
Jul 21 '08 #2
Smurfas
30
"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("127.0.0.2").HostName;
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
Jul 21 '08 #3
DrBunchman
979 Expert 512MB
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
Jul 21 '08 #4
Smurfas
30
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
Jul 21 '08 #5
DrBunchman
979 Expert 512MB
The above method will probably only work if you have a DNS Server. Do you?
Jul 22 '08 #6
Smurfas
30
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.Identity.Name;
name = name.Substring(name.IndexOf(@"\") + 1);

I hop understant my question.
I wont like this:
string name = Page.User.Identity(IP).Name; - but don't work. How make, what this work
Jul 26 '08 #7
Smurfas
30
Nobody have Idias? :[
Jul 28 '08 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Arne | last post by:
Hi, Probably an easy answer to this, but I have not been able to figure it out. How can I find the IP-address of the machine that my Java-program is running on ? Could not find any methods in...
1
by: Rusty | last post by:
I am trying to find the ip of my machine, but all I get is the local ip, not the ip I want. This is a program that finds the local ip, what should be modified: #include <stdio.h> #include...
29
by: chellappa | last post by:
hi all I need to write a program to find mac address of a my computer using libaries, is this possible? How? thanks
1
by: Dan Bart | last post by:
I have developed an ASP.NET application (VB.NET) using Visual Studio.NET 2002 and .NET Framework 1.0 Version 1.0.3705 This application is being hosted on a dedicated web server 2.4GHz machine with...
12
by: Souljaz | last post by:
Hi, how to find IP address. Thanks
5
by: Hooyoo | last post by:
Hi, here, How to get local machine name and IP address? Thanks.
10
by: OppThumb | last post by:
Hi, I've been searching this newsgroup for an answer to my question, and the closest I've come asks my question, but in reverse ("How to figure out the program from plan/package"). I've -- shall...
15
by: sunny | last post by:
Hai, Anybody can give me idea how to get the ip address of my machine through a cprogram with out using the socket programming. Is there any system call to get the ip address of my machine...
11
by: AAaron123 | last post by:
I have an vs2008 app that generates a website. I have a vs2008 app that uses the webbrowser and does this: WebBrowser1.Navigate(New Uri(address)) the address is: ...
3
by: Al Reid | last post by:
I need a way to uniquely identify the machine, IP Address or user that called a web service. We are attempting to loosely integrate two applications where both apps, running on a single machine,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.