I just a moment ago saw a request for finding the MAC adress of a remote host. An answer was that the MAC address is always sent as part of the TCP/IP protocol.
How would I go about retrieving this information from an ASP.NET C# application?
Any such answer is false. The MAC address of an adapter is only available on the same network segment. Not on the other side of a router.
If your remote device is SNMP-enabled you can query it for its ARP cache. That will have the MAC address in it. See this FAQ entry for more info.
Simple Answer: You can't.
Complex answer: You can, but you need to read the output from "arp -a" command. That might get difficult, depending on how many connections you currently have through your NIC (wireless or wired).
The only way that I can think of to get this from the network itself depends on interfacing with network management software with SNMP or RMON. Currently, I'm using a Java Applet on the client (see my answer to the other question), but it has some limitations. I'm hoping to meet with our network engineers to see if there is a way to get the same information server-side by interrogating the network switches. If such a solution exists, it will likely be specific to whatever network management software you are running.
You can build it into the application itself and have the application send the mac address in any messages that it may already be sending. Other than that, John nailed it.
Edit: Oh, if this is a "web app" and the "client app" is a browser, yeah, no go.
来源:https://stackoverflow.com/questions/1092463/getting-the-mac-address-of-the-remote-host