本文介绍了如何在ASP .NET中获取客户端PC MAC地址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好朋友我有网络应用程序,我应用mac地址验证。在本地IIS服务器上它的工作正常代码返回pc mac aadreess但是当我在服务器上发布我的web应用程序时,代码不返回pc mac地址。它的返回服务器端mac地址......这是我的代码。



我尝试了什么:



Hello Friends I have web application in that i am apply mac address validation. On local IIS server its work fine code return pc mac aadreess but when i am published my web application on server, code not returns pc mac address. Its return server side mac address ...this is my code.

What I have tried:

NetworkInterface[] nics = NetworkInterface.GetAllNetworkInterfaces();
                String sMacAddress = string.Empty;
                foreach (NetworkInterface adapter in nics)
                {
                    if (sMacAddress == String.Empty)// only return MAC Address from first card
                    {
                       PhysicalAddress properties = adapter.GetPhysicalAddress();
                       sMacAddress = adapter.GetPhysicalAddress().ToString();
                      MACtxt.Text = string.Join(":", (from z in adapter.GetPhysicalAddress().GetAddressBytes() select z.ToString("X2")).ToArray());
                   }
                }

推荐答案


这篇关于如何在ASP .NET中获取客户端PC MAC地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-18 10:31