Click here to Skip to main content
15,893,668 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How can we get MAC Address in asp.net

I have seen some articles and with the help of those article i can get mac address
but it gets address in "00114313D615" this format

but actual format is like this

"00-11-43-13-D1-65"


so how can i get mac address in actual format
Posted

1 solution

VB
Imports System.Management
Public Function GetSerial() As String
        Dim mc As New ManagementClass("Win32_NetworkAdapterConfiguration")
        Dim mac As String = ""
        Dim moc As ManagementObjectCollection = mc.GetInstances

        For Each mo As ManagementObject In moc
            If mo.Item("IPEnabled") Then
                mac = mo.Item("MacAddress").ToString
            End If
        Next
 mac = mac.Replace(":", "-")
 Return mac

End Function


Use this code......:)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900