如何在ASP .NET中获取客户端PC MAC地址 [英] How to fetch client pc MAC address in ASP .NET

查看:88
本文介绍了如何在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());
                   }
                }

推荐答案

据我所知你无法获得客户端 MAC 来自服务器端。如果你确实需要这样的信息(你确定你确实需要它吗?),那么客户端必须将它传递给服务器。
As far as I know you cannot get client MAC from server side. If you really need such a information (are you sure you really need it?), then the client must pass it to the server.


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

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆