Getting MAC Address of Client Machine in C #

Usually MAC address is also used to keep track of the unique Identification, if IP Address are not static, Every then from same system it will generate different IP Address, so cannot be keep records for unique, unless it is Static IP.

But MAC is set in users hardware system it is easy to trace, it is also used in E-commerce website, even IRCTC uses MAC Address to traces the records to trace the number of new user per day.

A media access control address (MAC address), also called physical address, is a unique identifier assigned to network interfaces for communications on the physical network segment.

MAC addresses are used as a network address for most IEEE 802 network technologies, including Ethernet and WiFi. Logically, MAC addresses are used in the media access control protocol sublayer of the OSI reference model.
MAC addresses are most often assigned by the manufacturer of a network interface controller (NIC) and are stored in its hardware, such as the card’s read-only memory or some other firmware mechanism.

If assigned by the manufacturer, a MAC address usually encodes the manufacturer’s registered identification number and may be referred to as the burned-in address (BIA). It may also be known as an Ethernet hardware address (EHA), hardware address or physical address. This can be contrasted to a programmed address, where the host device issues commands to the NIC to use an arbitrary address.

How do I find out the MAC address of my computer? (Windows)
• Click the Start icon
• Click Control Panel
• Select Network and Internet
• Click Network and Sharing Centre
• Select Change Adapter Settings from the list on the left hand side
• You may have a separate icon for your Wireless connection, Ethernet (Wired) and a Virtual WiFi MiniPort. Each has its own MAC address.
• Right click on the connection you are trying to find the MAC address for and select Properties
• Hover your mouse over the text box underneath connect using . Your MAC address will appear in the tooltip and is made up of 12 characters e.g. 00:11:22:AA:66:DD
using System.Management;
using System.IO;

protected void Page_Load(object sender, EventArgs e)
{
string MacAddress = GetMACAddress();
}

public string GetMACAddress()
{
string macAddresses = “”;

foreach (System.Net.NetworkInformation.NetworkInterface nic in System.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces())
{
if (nic.OperationalStatus == System.Net.NetworkInformation.OperationalStatus.Up)
{
macAddresses += nic.GetPhysicalAddress().ToString();
break;
}
}
return macAddresses;
}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s