Wednesday, August 28, 2013

How to get computer name which is in another domain or network


Hi, I have a computer (MyPc) in "ABC" domain and my webserver is in "XYZ" domain at the same time both are having a different DNS.


Now i need to get the hostname of my computer which is in "ABC" domain when i am sending request from "XYZ" network. I have used the below codes but it is giving IP address of the computer instead of hostname. IP


HostEntry host;


IPAddress address = IPAddress.Parse(ipaddr);


host = Dns.GetHostEntry(address); Console.WriteLine(host.HostName.ToString());


string[] computer_name = System.Net.Dns.GetHostEntry(Request.ServerVariables["remote_host"]).HostName.Split(new Char[] { '.' });


string clientPCName = System.Net.Dns.GetHostEntry(Request.UserHostAddress).HostName.ToString(); Pl


ease help me with the code to queries the DNS of the client, not the Server.



No comments:

Post a Comment