csharpGETTING LOCAL MACHINE'S MAC ADDRESS IN C#- Mar 10, 2011 Here’s a way to get the local machine’s MAC address in C#. Note that there may be various MAC addresses (Ethernet cards, local loopback devices, hooked up 3G devices etc.), so we try to find only the Ethernet MAC address. static string GetMacAddress() { string macAddresses = ""; foreach (NetworkInterface nic in NetworkInterface.GetAllNetworkInterfaces()) { // Only consider Ethernet network interfaces, thereby ignoring any // loopback devices etc. if (nic.NetworkInterfaceType != NetworkInterfaceType.Ethernet) continue; if (nic.OperationalStatus == OperationalStatus.Up) { macAddresses += nic.GetPhysicalAddress().ToString(); break; } } return macAddresses; } Please enable JavaScript to view the comments powered by Disqus.