jitendra rawat

jitendra rawat

  • NA
  • 15
  • 3.8k

how to get client side mac ID.

Apr 22 2016 4:06 AM
below is the code which i am using to get mac address, but when i publish this on server  its taking the mac id of server. but what i want is to get mac id of client machine in which i am working.
 
Thanx in advance
public string GetMac()
{
string Mac = string.Empty;
ManagementClass MC = new ManagementClass("Win32_NetworkAdapter");
ManagementObjectCollection M0col = MC.GetInstances();
foreach (ManagementObject M0 in M0col)
if (M0 != null)
{
if (M0["MacAddress"] != null)
{
Mac = M0["MACAddress"].ToString();
if (Mac != string.Empty)
break;
}
}
return Mac;
}
}
}


Answers (1)