almost 8 years ago
Does anybody know reliable way to get MAC address of Client PC using ASP.Net / C#.
I am using framework 3.5.
Below is the code I am using working fine on locally / IIS.
But this works on a site having full trust level. But doesn't work with medium trust level.
<p>public string GetMACAddress()
NetworkInterface nics = NetworkInterface.GetAllNetworkInterfaces();
String sMacAddress = string.Empty;
foreach (NetworkInterface adapter in nics)
if (sMacAddress == String.Empty)// only return MAC Address from first card <br>
IPInterfaceProperties properties = adapter.GetIPProperties();
sMacAddress = adapter.GetPhysicalAddress().ToString();
} return sMacAddress;
Can somebody provide me an alternate way to get Mac address of the client
over 6 years ago
private static string getMacAddress(string distIP)
IPAddress dIP = IPAddress.Parse(distIP); // the destination IP address
byte macAddr = new byte;
uint macAddrLen = (uint)macAddr.Length;
if (SendARP(BitConverter.ToInt32(dIP.GetAddressBytes(), 0), 0, macAddr, ref macAddrLen) != 0)
throw new InvalidOperationException("SendARP failed.");
string str = new string[(int)macAddrLen];
for (int i = 0; i < macAddrLen; i++)
str[i] = macAddr[i].ToString("x2");
return string.Join("-", str);
The code mentioned here will only work for the machine where it runs being the server side code.
We have tried to search for the MAC IP address in the request we get from the client but we did not get any success.
Its still open from our side and will share the solution if we find any.
Starting with Chrome version 45, NPAPI is no longer supported for Google Chrome. For more information, see Chrome and NPAPI (blog.chromium.org).
Firefox and Microsoft Internet Explorer are recommended browsers for websites using java applets.
Chrome Version Support
Are you sure, you want to delete this comment?
Terms of Service
| © copyright 2022 FindNerd.com. All rights reserved.
Sign up using