如何在MVC中获取客户端MAC地址

时间:2019-05-09 11:00:38

标签: asp.net-mvc model-view-controller asp.net-mvc-5 mac-address

我已经登录了页面,我想获取用户客户端的Mac地址,但是当我发布到服务器并获取服务器MACID时,我写了这段代码。如何获取用户客户端地址

string NetworkMacID = "";
IPGlobalProperties computerProperties = IPGlobalProperties.GetIPGlobalProperties();
NetworkInterface[] nics = NetworkInterface.GetAllNetworkInterfaces();
if (nics == null || nics.Length < 1)
  NetworkMacID = "";
else
  NetworkMacID = nics[0].GetPhysicalAddress().ToString();

return NetworkMacID;

0 个答案:

没有答案
相关问题