473,387 Members | 1,423 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Find MAC address.

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
4 2438
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:uq**************@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
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
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)" <ti*****@despammed.com> wrote in message
news:Oz**************@tk2msftngp13.phx.gbl...
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:uq**************@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 #4
"Arun" <ss> wrote in message news:uq**************@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

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Arne | last post by:
Hi, Probably an easy answer to this, but I have not been able to figure it out. How can I find the IP-address of the machine that my Java-program is running on ? Could not find any methods in...
1
by: Galsaba | last post by:
Anyone knows how I can find a script for "Find a Dealer near you" locator script? I prefer to have it in two stages: 1. The customer will enter his address, and then the result will be a list of...
8
by: pigeon | last post by:
I have 2 users that their client software must be going crazy.. they are sending packets every .02 seconds to the db server... I know this because I stuck a sniffer on teh traffic.. but now i just...
2
by: Phil | last post by:
Hi. I have a table containing primary address, secondary address, road,town, postcode, there are otherfields within the table requestid, round, day, etc. I want to find all instances of the...
12
by: Souljaz | last post by:
Hi, how to find IP address. Thanks
3
by: subirs | last post by:
Hi, I am using mtrace to check for memory leaks in my code. The code is divided into many fucntion which are placed in different directories. While using mtrace the following output is given....
11
by: bijayadipti | last post by:
Hi, I have a C program. I have compiled it uisng gcc and also avr-gcc. Now after compiling, I want to know the addresses of the two variables in my program. Is there any options that I can use...
10
by: Christian Chrismann | last post by:
Hi, I've a question on the STL find algorithm: My code: int main( void ) { vector< ClassA* myVector; ClassA *ptrElement1 = ...;
10
by: OppThumb | last post by:
Hi, I've been searching this newsgroup for an answer to my question, and the closest I've come asks my question, but in reverse ("How to figure out the program from plan/package"). I've -- shall...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.