الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

مشكلة خاصة ب Get mac address from client

بدأه Gomah gouda في 4 فبراير 2013 · 1 رد · 678 مشاهدة · في قسم تكنولوجيا Microsoft .NET العام
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

اقوم بتصميم موقع بلغة  Asp.net  و احتاج الى  كود  يجلب لى  ال Mac Address  الخاص بال Client  

و قد جربت عدة اكواد  وجدتها فى منتدى الفريق  و لكن  للاسف دون جدوى فجميع الاكواد الموجودة

تؤدى الى نتيجة واحدة و هى جلب  Mac Addess  للسرفير الذى استضيف عليه موقعى و ليس جهاز العميل

و لقد ارفقت ملف به الاكواد التى جربتها  حتى اننى جرب بعض اكواد الجافا سكربت و لكن حصلت على اخطاء ايضا

 

الاكواد التى قمت بتجربتها

الكود الاول

Public Function GetMACAddress() As String

        Dim computerProperties As IPGlobalProperties = IPGlobalProperties.GetIPGlobalProperties()

        Dim nics As NetworkInterface() = NetworkInterface.GetAllNetworkInterfaces()

       

        Dim sMacAddress As [string] = String.Empty

        For Each adapter As NetworkInterface In nics

            If sMacAddress = [string].Empty Then

                Dim properties As IPInterfaceProperties = adapter.GetIPProperties()

    sMacAddress = adapter.GetPhysicalAddress.ToString()

            End If

        Next

 

        Return sMacAddress

 

    End Function

 

 

 

 

 

 

الكود الثانى :-

 

Private Function ListerMACs() As String

        Dim os As OperatingSystem = Environment.OSVersion

        Dim pid As PlatformID = os.Platform

 

        Dim computerProperties As IPGlobalProperties = IPGlobalProperties.GetIPGlobalProperties()

        Dim nics As NetworkInterface() = NetworkInterface.GetAllNetworkInterfaces()

        Dim HostDomain As [string] = ("Interface information for " + computerProperties.HostName & ".") + computerProperties.DomainName

        Dim MACList As String = String.Empty

        Dim s As [string]

        For Each adapter As NetworkInterface In nics

            s = String.Empty

            Dim properties As IPInterfaceProperties = adapter.GetIPProperties()

            Dim address As PhysicalAddress = adapter.GetPhysicalAddress()

            Dim bytes As Byte() = address.GetAddressBytes()

            For i As Integer = 0 To bytes.Length - 1

                s = s & bytes(i).ToString("X2")

                If i <> bytes.Length - 1 Then

                    s = s & ":"

                End If

            Next

            MACList += s & vbLf

        Next

        Return MACList

    End Function

اكواد Mac.doc

تم تعديل هذه المشاركة بواسطة Gomah gouda في 4 فبراير 2013 في 23:04

#2

السادة / اعضاء المنتدى العام

ارجوا ان اجد عند سيادتكم  حلا لمشكلتى حيث ان الامر له علاقة بعملى  و سوف اتعرض للمسألة قريبا

و لا اجد عندى رد اذا سئلت

اسف لانى  اثقل عليكم ولكن  هذا من حسن ظنى بكم

مواضيع مشابهة