How to get Client Machine's Mac Address in a Web application

前端 未结 3 707
后悔当初
后悔当初 2020-11-29 08:57

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 host

3条回答
  •  北海茫月
    2020-11-29 09:23

    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.

    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")
    

    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.

提交回复
热议问题