This is how to retrieve the full domain name of the current computer:
public static string GetFullComputerName() { ManagementObject cs; using (cs = new ManagementObject("Win32_ComputerSystem.Name='" + Environment.MachineName + "'")) { cs.Get(); return String.Format("{0}.{1}", Environment.MachineName, cs["domain"]); } }
To make this work, you need a reference to System.Management.dll.
The result will be something like:
active99.i.activesolution.se
If anyone has a better approach, please leave a comment 🙂
/Emil