2

i want get mac address of my website visitor in asp.net how can i do it?

this code get host mac address

            ManagementClass objMC = new  ManagementClass("Win32_NetworkAdapterConfiguration");
        ManagementObjectCollection objMOC = objMC.GetInstances();

        foreach (ManagementObject objMO in objMOC)
        {
            if (!(bool)objMO["ipEnabled"])
                continue;

            string a = ((string)objMO["MACAddress"]);
        }
1
  • 1
    Your only option is to have something running on the client. Ages ago, you would accomplish this using ActiveX :). Today, I don't think it is possible, even using modern-day equivalent techniques, like google NaCl. But then, why would you want the MAC address? It is not a good idea... Commented Jan 23, 2013 at 9:58

1 Answer 1

8

You cannot get the MAC of your visitor because MAC addresses do not survive hops across different hosts like IP addresses do. At the most what you could get is the MAC of the switch closest to the server, and even in that case I 'm not sure it is technically possible from ASP.NET.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.