Web server to obtain the MAC address of the client computer

I am trying to create complex material for a winform C # application that is being created online and is trying to gather some information here and there. I looked on the Internet that you can get the mac address of a computer on the network using either System.Net.NetworkInformation or System.Management.ManagementClass (which I cannot reference for some reason). Where are my worries

  • Can my web server know the MAC address of the client machine connected to it?
  • If question 1 is correct, I assume that it will use IP (correct me if I am wrong), what if the client machine is sitting at the proxy server or is using several web proxies?
  • if question 1 and 2 are positive. How to do it from a web server.
+1
source share
3 answers

No, there is no easy way to do this.

The MAC address is only allowed on the same subnet - it is assumed that this is not a fairly small intranet application, you will not be on the same subnet as your clients.

Theoretically, a request to work with a remote WMI will work, but problems with the firewall and permissions are not trivial. Again, if you cannot control all the customers, you are unlikely to be successful here.

The only thing you can do is a downloadable application - perhaps Flash, Silverlight, or ActiveX - that polled the local machine for you. I am not sure that this information will be isolated by the browser.

I assume that there is an easier way to do what you are trying to do, but you will need to provide more details on why you want the MAC address.

+5
source

You cannot get any information from the web server, and you should not try. Note that machines can have multiple IP addresses and multiple MAC addresses and may be behind a proxy server or network address translation device or worse.

IP addresses are network layer and should not normally be used by the application layer. If nothing else, it is unlikely that network administrators will consult with developers when making changes to the network, which will invalidate your assumptions.

0
source

As other answers show, getting an IP address may not do what you need. What are you trying to use this information for?

You can try using System.Management.ManagementObjectSearcher to request this type of information. I know that this can be used to capture the MAC address of each connected network adapter. This logic should be on the client side, which can then transfer any information you need for the server.

It looks like this post on Google Groups can do what you need. Here is an interesting bit:

using System.Management; ObjectQuery query = new ManagementObjectSearcher("SELECT * FROM Win32_NetworkAdapterConfiguration"); ManagementObjectCollection queryCollection = query.Get(); foreach( ManagementObject mo in queryCollection ) { foreach(string s in addresses) { Console.WriteLine( "IP Address '{0}'", s); } foreach(string s in subnets) { Console.WriteLine( "IP Subnet '{0}'", s); } } 
0
source

All Articles