lundi 7 novembre 2016

how to get the Mac Address of client machine in c# MVC

I have tried to get the Mac Address of local/client's machine but I am getting Mac address same in any of the device or computer. I have using th below code.

string macAddresses=null;
NetworkInterface[] nics = NetworkInterface.GetAllNetworkInterfaces();
foreach (NetworkInterface nic in NetworkInterface.GetAllNetworkInterfaces())
{
   if (nic.OperationalStatus == OperationalStatus.Up)
   {
       macAddresses += nic.GetPhysicalAddress().ToString();
       break;
    }
 }

Also, I have tried this link but I don't know how to add the reference of ManagementClass

Thanks in advance.




Aucun commentaire:

Enregistrer un commentaire