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

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

问题描述

我有我的网站运行从哪里得到客户的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本身可能不会允许它<一个href=\"http://stackoverflow.com/questions/4467905/getting-mac-address-on-a-web-page-using-a-java-applet\">Getting使用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.

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

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