Find MAC address.

  • Thread starter Thread starter Arun
  • Start date Start date
A

Arun

Like its possible to find IP address of a visitor in same way is it possible to find the visitor's PC's MAC address?

-Regards,
 
look in the servervariables collection

--
Regards

John Timney (Microsoft ASP.NET MVP)
----------------------------------------------
<shameless_author_plug>
Professional .NET for Java Developers with C#
ISBN:1-861007-91-4
Professional Windows Forms
ISBN: 1861005547
Professional JSP 2nd Edition
ISBN: 1861004958
Professional JSP
ISBN: 1861003625
Beginning JSP Web Development
ISBN: 1861002092
</shameless_author_plug>
----------------------------------------------

"Arun" <ss> wrote in message Like its possible to find IP address of a visitor in same way is it possible
to find the visitor's PC's MAC address?

-Regards,
 
Hi,

use WMI :

private static string GetMacAddress()
{
ManagementClass mc = new ManagementClass("Win32_NetworkAdapter");
foreach (ManagementObject mo in mc.GetInstances())
{
string macAddr = mo["MACAddress"] as string;
if ( macAddr != null && macAddr.Trim() != "" )
return macAddr;
}
return "";
}


Natty Gur[MVP]
Phone Numbers:
Office: +972-(0)9-7740261
Fax: +972-(0)9-7740261
Mobile: +972-(0)58-888377
 
sorry - misread your post. Thought you were looking for the IP address.

--
Regards

John Timney (Microsoft ASP.NET MVP)
----------------------------------------------
<shameless_author_plug>
Professional .NET for Java Developers with C#
ISBN:1-861007-91-4
Professional Windows Forms
ISBN: 1861005547
Professional JSP 2nd Edition
ISBN: 1861004958
Professional JSP
ISBN: 1861003625
Beginning JSP Web Development
ISBN: 1861002092
</shameless_author_plug>
 
"Arun" <ss> wrote in message Like its possible to find IP address of a visitor in same way is it possible
to find the visitor's PC's MAC address?

Yes. Exactly the same way. It usually won't work, just as getting the
visitor's IP address usually won't work.

If the visitor is coming to you from behind a proxy server or NAT box or
something else like that, then you will not know the user's IP address, only
that of the NAT box or proxy server.

Similarly, you can _never_ get the MAC address of a visitor unless the
visitor is directly on the same LAN as your server. If the visitor gets to
your server through a router, then you cannot get the MAC address.

In any case, IP addresses are for routing packets, MAC addresses are for
sending packets between NICs on the same LAN, so unless you're a router or a
NIC, you shouldn't be messing with IP addresses or MAC addresses. Using
these things for anything other than for what they were intended is likely
to get you into trouble in the long run.
 
Back
Top