Kayıtlar

.net core ile kullanıcıların mac adresini okuma etiketine sahip yayınlar gösteriliyor

.net core ile kullanıcıların mac adresini okuma

 .NET Core ile kullanıcıların MAC adreslerini okumak için aşağıdaki gibi bir kod bloğu kullanabilirsiniz: using System.Net; using System.Net.NetworkInformation; public string GetUserMacAddress() { // Kullanıcının IP adresini alıyoruz string userIP = HttpContext.Connection.RemoteIpAddress.ToString(); // Kullanıcının IP adresine ait MAC adresini alıyoruz string userMacAddress = string.Empty; foreach (NetworkInterface nic in NetworkInterface.GetAllNetworkInterfaces()) {     if (nic.OperationalStatus == OperationalStatus.Up)     {         foreach (UnicastIPAddressInformation ip in nic.GetIPProperties().UnicastAddresses)         {             if (ip.Address.ToString() == userIP)             {                 userMacAddress = nic.GetPhysicalAddress().ToString();                 break;             }         }     } } // Kullanıcının MAC adresini döndürüyoruz return userMacAddress; Bu kod bloğu sayesinde, bir kullanıcının IP adresine ait MAC adresini alabilir ve kullanabilirsiniz. Ayrıca, bu a