364,032 Members | 4401 Browsing Online
Community for Developers & IT Professionals
Bytes IT Community

Find MAC address.

Arun
P: n/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,

Nov 17 '05 #1
Share this Question
Share on Google+
4 Replies


John Timney \(Microsoft MVP\)
P: n/a
John Timney \(Microsoft MVP\)
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 news:uqxE4OgoDHA.1740@TK2MSFTNGP12.phx.gbl...
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,



Nov 17 '05 #2

Natty Gur
P: n/a
Natty Gur
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


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 17 '05 #3

John Timney \(Microsoft MVP\)
P: n/a
John Timney \(Microsoft MVP\)
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>
----------------------------------------------

"John Timney (Microsoft MVP)" <timneyj@despammed.com> wrote in message
news:OzEDEUjoDHA.2964@tk2msftngp13.phx.gbl...[color=blue]
> 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 news:uqxE4OgoDHA.1740@TK2MSFTNGP12.phx.gbl...
> Like its possible to find IP address of a visitor in same way is it[/color]
possible[color=blue]
> to find the visitor's PC's MAC address?
>
> -Regards,
>
>
>[/color]


Nov 17 '05 #4

John Saunders
P: n/a
John Saunders
"Arun" <ss> wrote in message news:uqxE4OgoDHA.1740@TK2MSFTNGP12.phx.gbl...
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.
--
John


Nov 17 '05 #5

Post your reply

Help answer this question



Didn't find the answer to your ASP.NET question?

You can also browse similar questions: ASP.NET