Mac Address

MAC addresses are 12-digit hexadecimal numbers (48 bits in length). By convention, MAC addresses are usually written in one of the following two formats:MM:MM:MM:SS:SS:SS
The MAC address is a unique value associated with a network adapter. MAC addresses are also known as hardware addresses or physical addresses. They uniquely identify an adapter on a LAN.
The first half of a MAC address contains the ID number of the adapter manufacturer. These IDs are regulated by an Internet standards body (see sidebar). The second half of a MAC address represents the serial number assigned to the adapter by the manufacturer. In the example,
00:A0:C9:14:C8:29    (00A0C9)

indicates the manufacturer is Intel Corporation.

Here is small code

protected void Page_Load(object sender, EventArgs e)
{
string strMessage = MacAddress("10.60.21.108");
Response.Write(strMessage +
"<br>");
}
public string MacAddress(string IPAddress)
{
string strMcAddr = string.Empty;
try
{
string strTmpMcAddr = string.Empty;
ProcessStartInfo objPrcInfo = new ProcessStartInfo();
Process objProcess = new Process();
objPrcInfo.FileName =
"nbtstat";
objPrcInfo.RedirectStandardInput =
false;
objPrcInfo.RedirectStandardOutput =
true;
objPrcInfo.Arguments =
"-A " + IPAddress;
objPrcInfo.UseShellExecute =
false;
objProcess =
Process.Start(objPrcInfo);
int Cnt = -1;
while (Cnt <= -1)
{
Cnt = strTmpMcAddr.Trim().ToLower().IndexOf(
"mac address", 0);
if (Cnt > -1)
{
break;
}
strTmpMcAddr = objProcess.StandardOutput.ReadLine();
}
objProcess.WaitForExit();
strMcAddr = strTmpMcAddr.Trim();
}
catch (Exception Ex)
{
Response.Write(Ex.Message);
}
return strMcAddr;
}

In Javascript also we can fetch Mac Address but you have to use ActiveX Controll.

Ebook Download
View all
Learn
View all