13
Jul

Get MAC address of client`s computer

   Posted by: admin   in .Net Emperor

Hello Friends,

Recently i got one request in which one of my client wants to get user`s MAC(Media Access Control) Address who access his website.

First of all let me tell you what is a MAC Address mean ?

A Media Access Control address (MAC address) is a unique identifier assigned to most network adapters or network interface cards (NICs) by the manufacturer for identification. A MAC address usually encodes the manufacturer’s registered identification number. It may also be known as an Ethernet Hardware Address (EHA), hardware address, adapter address, or physical address.MAC Addrees is unique address.

If you want to find out your computer`s mac address then simply open command prompt and type these two commands which will returns you mac address of your computer.

1) GETMAC

2) IPCONFIG/ALL

Here is the code that will returns mac address of any computer.

Imports System.Net.NetworkInformation

Public Function GetMACAddress() As String

Dim st As [String] = [String].Empty

For Each nic As NetworkInterface In NetworkInterface.GetAllNetworkInterfaces()

Dim ot As OperationalStatus = nic.OperationalStatus

If nic.OperationalStatus = OperationalStatus.Up Then

st = nic.GetPhysicalAddress().ToString()

Exit For

End If
Next

Return st

End Function

Enjoy the code if you will find out any kind of difficulties then please add comment on same article i will provide you solution for that.

Tags: ,

This entry was posted on Tuesday, July 13th, 2010 at 9:34 am and is filed under .Net Emperor. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

Leave a reply

Name (*)
Mail (will not be published) (*)
URI
Comment