Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

Get mac address of Device - NAYCode.com

  //**************** Source NAYCode.com
  private string GetDeviceInfo()
        {
            string mac = string.Empty;
            string ip = string.Empty;

            foreach (var netInterface in NetworkInterface.GetAllNetworkInterfaces())
            {
                if (netInterface.NetworkInterfaceType == NetworkInterfaceType.Wireless80211 ||
                    netInterface.NetworkInterfaceType == NetworkInterfaceType.Ethernet)
                {
                    var address = netInterface.GetPhysicalAddress();
                    mac = BitConverter.ToString(address.GetAddressBytes());

                    IPAddress[] addresses = Dns.GetHostAddresses(Dns.GetHostName());
                    if (addresses != null && addresses[0] != null)
                    {
                        ip = addresses[0].ToString();
                        break;
                    }
                }
            }

            return mac;
        }
      
Comment

PREVIOUS NEXT
Code Example
Csharp :: filter enum using linq query 
Csharp :: c# result set from stored procedure 
Csharp :: C# sprint key 
Csharp :: UnitType parameter revit 2022 
Csharp :: C# create delegate type at runtime 
Csharp :: WixSharp-FirewallException 
Csharp :: TTTTTTTTTTTTTTTTTTTTESTTT 
Csharp :: grass download for unityh 
Csharp :: Worker service as Windows Service 
Csharp :: unity control physics of multiple simulation 
Csharp :: flutterwave c# api integration 
Csharp :: entity framework attach 
Csharp :: multiple lines in string c# parameterized 
Csharp :: add numbers c# 
Csharp :: how to call method in different project in c# visual studio 
Csharp :: dotnet DB context register 
Csharp :: c# null coalescing operator 
Csharp :: how to create a point c# 
Csharp :: shallow copy vs deep copy c# 
Csharp :: unity event trigger 
Csharp :: build a project from dotnet using cli 
Csharp :: unity audio source playoneshot 
Csharp :: Load Level Action for unity 
Csharp :: forces the user to enter his password before submitting the form asp.net core 
Html :: html pound symbol 
Html :: how to import font awesome in html 
Html :: http://127.0.0.1:5500/favicon.ico 
Html :: input type that allows float number 
Html :: new tab in html 
Html :: remove underline html 
ADD CONTENT
Topic
Content
Source link
Name
4+7 =