I am developing software using ASP.NET C# in which I want to allow only users from specific machines to login to the software, i.e I want a user to login from his office computer but he shouldn't be allowed to login to the website from his home computer or any other computer. To achieve this, I tried to get the mac address of the client computer using code in C# but this code is only returning the mac address of the server. Also, I read on the internet that getting mac address of client computers is inefficient. So I want to know if there any better ways to identify the client computer from the server. I'm using the following code.
string macAddresses = "";
foreach (NetworkInterface nic in NetworkInterface.GetAllNetworkInterfaces())
{
if (nic.OperationalStatus == OperationalStatus.Up)
{
macAddresses += nic.GetPhysicalAddress().ToString();
break;
}
}
Response.Write( macAddresses);