static void Main(string[] args) { Console.WriteLine("Current Logged UserName: " + Environment.UserName); Console.WriteLine("Local Machine Name: " + Environment.MachineName); Console.WriteLine("Local Machine Name: " + Dns.GetHostName()); // Dns from System.Net // Console.WriteLine("IPHostEntry: " + Dns.GetHostByName(Dns.GetHostName)); // Dns from System.Net IPHostEntry ip = Dns.GetHostEntry (Dns.GetHostName()); IPAddress[] IPaddr = ip.AddressList; for (int i = 0; i < IPaddr.Length; i++) {Console.WriteLine("IP Address {0}: {1} ", i, IPaddr[i].ToString());} Console.ReadLine(); }
System.Security.Principal.WindowsIdentity.GetCurrent().Name
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)