The Windows OS applications (e.g., Chrome browser) are built using ASP.NET framework (C#
programming language). This framework provides four ways to get the name of the machine or
computer:
- string MachineName 1 = Environment.MachineName;
- string MachineName2 = System.Net.Dns.GetHostName();
- string MachineName3 = Request.ServerVariables[“REMOTE_HOST”].ToString(); and
- string MachineName4 = System.Environment.GetEnvironmentVariable(“COMPUTERNAME”).
// Sample for the Environment.MachineName property
using System
class Sample {
public static void Main() {
Console.WriteLine();
// <-- Keep this information secure! -->
Console.WriteLine("MachineName: {0}", Environment.MachineName);
}
}
