When building a system with a B/S structure, we often need to obtain some information about the client, such as IP and MAC, in order to combine it with identity authentication. In ASP.NET, it is easy to obtain the MAC address of the server, but it does take a lot of effort to obtain the MAC address of the client. The usual method is to call Win32API or directly call the nbtstat command. There are many problems with this, and the other The first method is to directly use client-side scripts. We use Javascript here. The advantage of this is that it does not require server-side processing. The client can obtain it by itself and pass it to the server-side, and the speed and reliability are better than obtaining it on the server-side.
The specific implementation of html and javascript is as follows: