ASP.NET获取客户端MAC地址
/// <summary>/// get MacAddress
/// </summary>
/// <returns></returns>
public static string GetMac()
{www.zzzyk.com
string MacAddress = String.Empty;
ManagementClass mc = new ManagementClass("Win32_NetworkAdapterConfiguration");
ManagementObjectCollection moc = mc.GetInstances();
foreach (ManagementObject mo in moc)
{
if ((bool)mo["IPEnabled"] == true)
{
MacAddress = mo["MacAddress"].ToString();
break;
}
}
moc = null;
mc = null;
// 将MAC地址用-分割
MacAddress = MacAddress.Replace(":", "-");
return MacAddress;
}
补充:Web开发 , ASP.Net ,