views:

1015

answers:

5

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?

See: Reference to sister-post

+7  A: 

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.

John Saunders
This has also always been my understanding, that the MAC Address was only ever available on the "local" network. I once heard of a guy who claimed he had done it.. but I've never seen any proof of it.
jAST
+2  A: 

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

joe
+3  A: 

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.

Brian Agnew
+1  A: 

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.

tvanfosson
A: 

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.

Allen