I have been trying whole day to get the MAC Address of the client PC. I have tried 2 ways to do so:
1) Using NetworkInterface: But it tries to retrieve the MAC address of server ( i.e where my website is hosted ) and returns error as server is not allowing it to access its MAC and I also dont need it.
2) Using ManagementObjectSearcher: while doing this I added reference of ManagementObject on my local machine and tested it, it worked completely fine. But when I uploaded it to Server its asking for the reference to be added first. For that i copied all the
management files from my App_Code folder to the App_code folder on my server, But still the error remained same.
Suggestions required on:
1) Is there any 3rd way of getting the MAC Address of the Clients PC (The one who browses the website at his home).
2) How can I add that ManagementObject reference to my server.
I'll be very thankful to one who gets me through this.
AFAIK you can't. It makes sense inside a network but AFAIK it is never transmitted outside a network. Also keep in mind that your C# code runs on the web server so using ManagementObject will still return the information for the web server (it appears to
work locally as you are in the very special case where the browser side machine and the web server side machine is the same machine).
I assume you try to uniquely identity machines that are connected to your app? AFAIK there is no bullet proof way to do that (or at least it would discourage most users from using your site).
My first move would be to save a guid value to a cookie (once I'm sure it does bring some valuable benefit). You'll have also to take into account that this cookuie could be cleared sooner or later.
None
0 Points
4 Posts
Getting MAC Address of a Client's PC
Apr 18, 2018 12:35 PM|Huzaifa Juzer|LINK
I have been trying whole day to get the MAC Address of the client PC. I have tried 2 ways to do so:
1) Using NetworkInterface: But it tries to retrieve the MAC address of server ( i.e where my website is hosted ) and returns error as server is not allowing it to access its MAC and I also dont need it.
2) Using ManagementObjectSearcher: while doing this I added reference of ManagementObject on my local machine and tested it, it worked completely fine. But when I uploaded it to Server its asking for the reference to be added first. For that i copied all the management files from my App_Code folder to the App_code folder on my server, But still the error remained same.
Suggestions required on:
1) Is there any 3rd way of getting the MAC Address of the Clients PC (The one who browses the website at his home).
2) How can I add that ManagementObject reference to my server.
I'll be very thankful to one who gets me through this.
All-Star
48530 Points
18077 Posts
Re: Getting MAC Address of a Client's PC
Apr 18, 2018 01:01 PM|PatriceSc|LINK
Hi,
AFAIK you can't. It makes sense inside a network but AFAIK it is never transmitted outside a network. Also keep in mind that your C# code runs on the web server so using ManagementObject will still return the information for the web server (it appears to work locally as you are in the very special case where the browser side machine and the web server side machine is the same machine).
I assume you try to uniquely identity machines that are connected to your app? AFAIK there is no bullet proof way to do that (or at least it would discourage most users from using your site).
My first move would be to save a guid value to a cookie (once I'm sure it does bring some valuable benefit). You'll have also to take into account that this cookuie could be cleared sooner or later.
None
0 Points
4 Posts
Re: Getting MAC Address of a Client's PC
Apr 19, 2018 11:49 AM|Huzaifa Juzer|LINK
Okay Thanks Patrice. I guess I have to leave this issue here now.