如何在 Web 应用程序中获取客户端计算机的 Mac 地址 [英] How to get Client Machine's Mac Address in a Web application

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

问题描述

我必须获取运行我的网站的客户端 PC 的 Mac 地址.那么如何获取客户端机器的 Mac 地址(而不是托管网站的服务器的 Mac 地址).我需要与 IE、Firefox、Safari 和 Chrome 兼容的脚本.

I have to get Mac Address of client's PC where my website is running. So how to get Mac Address of client's machine (not of the Server's Mac Address where website is hosted). I need script that is compatible with IE, Firefox, Safari and Chrome.

推荐答案

实现这一目标的唯一方法是使用小程序或插件,例如可以用 Java 编程(尽管根据 使用 Java 小程序获取网页上的 MAC 地址 ),因为 javascript 自然不会泄露此类信息.最后,如果它位于内部网络上,您也可以从服务器端找到此信息,这通常通过半专用 wifi 网络登录页面完成.

The only way to achieve this is by using an applet or plugin which could for example be programmed in java (although java itself might not allow it according to Getting MAC address on a web page using a Java applet ), as javascript will naturally not disclose this kind of information. Lastly you could also find this information from the server side if it's on an internal network as is often done with semi-private wifi network landing pages.

基于以下评论:由于它是内部网络,您可以在asp.net端按如下方式检索mac地址.您执行以下命令 arp -a 它将返回所有 ip 地址的列表以及关联的 mac 地址.接下来使用类似

Based on the comments below: As it's an internal network you can retrieve the mac address as follows on the asp.net side. You execute the following command arp -a which will return you a list of all ip addresses with associated mac addresses. Next using something along the lines of

Request.Servervariables("REMOTE_ADDR")

您应该能够找到用户的 ip 地址,接下来您可以将其与从 arp 命令检索到的数据进行匹配,瞧,您拥有当前用户的 mac 地址.

you should be able to find the users ip address which you can next match with the data you retrieved from the arp command and voila, you have your mac address for the current user.

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

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