如何使用c#asp.net查找客户端PC的MAC地址?

时间:2018-07-05 06:35:42

标签: c# asp.net mac-address

这是我用于查找MAC地址的代码,但是当我在任何设备上运行此代码时,它也会显示相同的结果?

 public string GetMACAddress1()
    {
        try
        {
            NetworkInterface[] anics=NetworkInterface.GetAllNetworkInterfaces();
            foreach (NetworkInterface adapter in anics)
            {
                if (amacaddress == String.Empty)
                {
                    IPInterfaceProperties properties =adapter.GetIPProperties();
                    amacaddress = adapter.GetPhysicalAddress().ToString();                       
                }
            }
            return "MAC Address is :- " + amacaddress;
        }
        catch
        {
            return "error";
        }
    }

我怎么能得到这个??

0 个答案:

没有答案