For smart Primates & ROBOTS (oh and ALIENS ).

Blogroll

Thursday, March 12, 2015

GET MAC ADDRESS IN C# VB.NET

Problem:

Some time you want to develop a software in C# or Vb.net that will run only on specific computer system. for this you use mac address of that system.

Solution:

Here the C# code that will fetch mac address.

Example:

System.Net.NetworkInformation.NetworkInterface[] nic= System.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces();
String macAddress = string.Empty;
foreach (System.Net.NetworkInformation.NetworkInterface ni in nic)
{
   System.Net.NetworkInformation.IPInterfaceProperties properties=ni.GetIPProperties();
   macAddress = ni.GetPhysicalAddress().ToString();
   if (macAddress != String.Empty) {
                        MessageBox.Show(macAddress);
                        return;
   } 

}



Share:

0 comments:

Post a Comment

Multiple attribute passing in querySelectorAll

Multiple attribute passing in querySelectorAll     Here I am demonstrating code to how to pass multiple attributes in querySelectorAll. <...

Ads Inside Post

Powered by Blogger.

Arsip

Blog Archive