I have code to retrieve mac address of user machine. It retrieves mac address if I deploy code using IIS. But when I upload code on windows server 2008 it returns server mac address instead of user machine.So how do I retrieve mac address from serevr 2008 using asp.net?
-
Any other option to retrieve mac from server 2008Developer– Developer2013-12-31 12:01:53 +00:00Commented Dec 31, 2013 at 12:01
-
I guess you can't do it unless client machine runs some software to report you it's mac address. IIS runs on higher layer of OSI model en.wikipedia.org/wiki/OSI_modeluser1455836– user14558362013-12-31 12:03:58 +00:00Commented Dec 31, 2013 at 12:03
-
Any sensible security will stop you getting it, and attempt at using mac address as an id can be spoofed easily, so why do you want it?Tony Hopkinson– Tony Hopkinson2013-12-31 12:06:27 +00:00Commented Dec 31, 2013 at 12:06
-
Which MAC address do you want? Were you aware that a machine may have more than one MAC address? Were you aware that they can be changed by software in some cases?John Saunders– John Saunders2013-12-31 12:07:11 +00:00Commented Dec 31, 2013 at 12:07
2 Answers
But when I upload code on windows server 2008 it returns server mac address instead of user machine
Because your code is running on server and not on client machine.
Now this effectively means that you need some sort of access on client machine in order to get the MAC address. And you won't get that mostly. Though there is a workaround as mentioned here, but the question is how important is it for you? You should try to live without it as it is not reliable solution.
Comments
Found this post on the forums
If the machine is not on your local network subnet (same cable etc) then it can't be done
It has example code of how to use SendArp to retrieve the mac address.
Maybe this helps