I have developed a software in C#, in which registration is done using mac id of PC as unique identifier. I registered the software on one PC using internet via usb tethering of my mobile, it took a mac id and got registered successfully. But when I tried to register on another PC using my mobile's internet via usb tethering, it is showing the same mac id which I got on registering first PC. I checked mac id of both PCs using ipconfig/all command in cmd and there same id is shown under physical address when my mobile is connected for internet. Why is this happening? What is the solution for this?
Code I used to fetch mac id:
string macAddresses = "", FinalmacAddresses = "";
foreach (NetworkInterface nic in NetworkInterface.GetAllNetworkInterfaces())
{
macAddresses = nic.GetPhysicalAddress().ToString();
break;
}
FinalmacAddresses = macAddresses.Trim().ToString();
return FinalmacAddresses;
First thing is, you should never use a mac address as a unique identifier. There are tools and even simple ways by which you can assign multiple devices with the same mac address (Mac address spoofing). That is also not good, if we look through the security perspective.
I would recommend using a GUID instead.