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

Add Dependent Scripts

   here is the code that allow to add dependent script :         <script>         const addDependentScripts = async function( scriptsT...

Ads Inside Post

Powered by Blogger.

Arsip

Blog Archive