MAC Address
-
In what context? Is this in a webservice, web application, windows service, active directory logon, vpn connection, remote desktop connection, citrix environment?
If you have knowledge, let others light their candles at it. Margaret Fuller (1810 - 1850) [My Articles] [My Website]
-
Do you mean the recent visitor of ASP.NET web site? :)
Life is a stage and we are all actors!
-
In what context? Is this in a webservice, web application, windows service, active directory logon, vpn connection, remote desktop connection, citrix environment?
If you have knowledge, let others light their candles at it. Margaret Fuller (1810 - 1850) [My Articles] [My Website]
-
To get IP of the visitor, you can use Javascript method: getHostAddress(). Getting Mac address will not be an easy task. I don't how or if you can get that, I am sure it is not easy.
50-50-90 rule: Anytime I have a 50-50 chance of getting something right, there's a 90% probability I'll get it wrong...!!
-
I've taken a quick review of the standart HttpRequest headers, [^] but there isn't anything for MAC addresses so I suppose you can't get User MAC from server side code.You need client side code to do that.I've found this solution based on JavaScript and WMI but it works only with IE because it requires to run ActiveX control on the client side.
Life is a stage and we are all actors!
-
HttpContext currentContext = HttpContext.Current;
string ip = currentContext.Request.UserHostAddress;
The MAC Address is unlikely to be the MAC of the machine browsing the web site. The MAC address of the IP packets changes as the packets pass through routers.
Ant. **I'm hard, yet soft.
I'm coloured, yet clear.
I'm fruity and sweet.
I'm jelly, what am I? Muse on it further, I shall return!**- David Walliams (Little Britain)
-
In a web application, there is no way to get the MAC address of the client. It wouldn't do you any good either since it only means something to the local subnet that the client machine is attached to. The MAC address that you might get is going to the from the last network interface to touch the packet before it got to your web server. This is usually the near-side of the last router or firewall that touched the packet before it got to your server. It will also be the same for every packet you get unless there is an alternate route for IP traffic to get to your server.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007, 2008
But no longer in 2009... -
There shouldn't be a need for it, but you could ask the visitor for it. :-D Don't attempt any sort of security or identity based on such addresses.