如何在asp.net中获取客户端计算机的Mac地址 [英] How to get Mac Address of Client Machine in asp.net

查看:191
本文介绍了如何在asp.net中获取客户端计算机的Mac地址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好朋友,

我需要Asp.Net中的客户端计算机Mac地址.

有可能吗?

代码应该在所有浏览器中都可以使用..


在Advance中致谢

Hello Friends,

I want the Client Machines Mac Address in Asp.Net.

Is it Possible or not ?

Code should work in all browser..


Thanks in Advance

推荐答案

这些笨拙的人都没有告诉您(因为他们不知道自己在做什么)是您想要的在大多数情况下.

到目前为止,提供的解决方案仅在Windows计算机上有效,并且仅在服务器ASP.NET帐户对客户端计算机具有权限的情况下才有效.很有可能您的ASP.NET服务器帐户根本没有对客户端计算机的任何权限.这意味着您无法使用WMI获得所需的信息.

这样就可以使用ARP解析物理地址.这样做的问题是,ARP仅在本地网络上有效.这意味着ARP将在呼叫者(您的服务器)本地的网络上返回物理地址.如果您尝试将IP地址解析为另一个子网中或跨Internet的某个远程计算机的物理地址,则将获取网络路径遇到的第一个路由器的近端接口的物理地址.服务器到客户端,而不是客户端计算机.

为什么?您必须阅读有关TCP/IP路由如何工作的信息.

哦,还有一件事. MAC地址不是唯一的.多台计算机的接口可以具有相同的MAC地址. MAC地址不能用于标识单个计算机,也不能用作加密或哈希算法中的唯一密钥.
What none of these schmucks are telling you (because they have no idea what they''re doing) is what you want isn''t possible in most cases.

The solutions provided so far will only work on Windows machines, IF and only IF your server ASP.NET account has permissions to the client machine. Chances are really good that your ASP.NET server account does NOT have any permissions at all to your client machines. That means you can''t get the info you want using WMI.

So that leaves resolving the physical address using ARP. The problem with that is ARP is only good on the local network. That means ARP will return physical address on the network local to the caller, your server. If you try to resolve an IP address to a physical address for a remote machine in another subnet or acrossed the internet somewhere, you''ll get back the physical address of the near-side interface of the first router your network path encounters going from the server to the client, not of the client machine.

Why? You''ll have to read up on how TCP/IP routing works.

Oh, and another thing. MAC addresses are NOT unique. Multiple computers CAN have the same MAC address for an interface. MAC addresses cannot be used to identify individual computers or as the sole key material in an encryption or hashing algorithm.


我认为您需要在IIS级别使用某种类型的过滤器才能获得IP数据包中的MAC地址,然后以某种方式将其注入到请求中.我不确定具体细节,但我知道您唯一要获得MAC地址的地方是在网络(套接字)级别.到您使用ASP.NET时,您与网络级别的抽象距离已经太远了. IIS过滤器甚至可能距离太远.

通过网络数据包获取MAC地址可能只会在同一网段上有效-介于两者之间的路由器会更改MAC地址.如果您想要MAC地址,您的客户端需要查询它并随请求一起发送.那时,这更是客户端技术上的障碍.
I think you''d need some type of filter at the IIS level to get the MAC address from the IP packets and inject it into the request somehow. I''m not sure of the details, but I know the only place you are going to get the MAC address is at the network (socket) level. By the time you are in ASP.NET, you are way too far abstracted from the network level. IIS filters may even be too far away.

Getting the MAC address via the network packet is likely only going to be valid on the same network segment -- routers in between will alter the MAC address. If you want the MAC address, your client needs to query it and send it with your request. It''s more a of client-side technical hurdle at that point.


请参阅以下内容:

我需要MAC使用asp.net的客户端计算机的地址 [ http://www.dotnetfunda.com/forums/thread2088-how-to-get-mac-address-of-client-machine.aspx [ http://stackoverflow.com/questions/2018982/how-to-get-mac-address-of-client-machine-in-c-sharp-and-vb-net [
Refer these:

i need MAC Address of client machine using asp.net[^]

http://www.dotnetfunda.com/forums/thread2088-how-to-get-mac-address-of-client-machine.aspx[^]

http://stackoverflow.com/questions/2018982/how-to-get-mac-address-of-client-machine-in-c-sharp-and-vb-net[^]


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

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