foreach (NetworkInterface nic in NetworkInterface.GetAllNetworkInterfaces())
{
if (nic.OperationalStatus == OperationalStatus.Up)
{
Console.WriteLine(nic.GetPhysicalAddress().ToString());
break;
}
}
Using .Net read the MAC Address from Network adapter
Questions: If you like to be able to read the mac address from the first active network adapter using .Net Winform application.
Solution: Since .Net 2.0 there's been a NetworkInterface class in the System.Net.NetworkInformation namespace that will give you this information. Try this: