cancel
Showing results for 
Search instead for 
Did you mean: 

Get MAC ADRESS

Former Member
0 Kudos

Hi,

We have a application on WEB AS. We would like to get MAC ADRESS of device when user access the application on first time.

We got the MAC ADRESS on Windows XP, but don't on Windows Mobile by JavaScript.

I know that using JavaAPI we just will get the MAC ADRESS of server and don't of the device.

Anybody knows a way to solution this?

Thanks for help.

Regards,

Bruno

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Bruno,

MAC address is also known as the physical ID of the Ethernet adapter a device have (despite being host PC or some mobile device). Actually you did not specified if your device is equipped with some kind of external Ethernet adapter or have some incorporated one...

However, without having neither of the two types you will not have MAC, I suppose it is clear to you..

Anyway, you can try this to obtain the MAC address on a Windows Mobile:

http://www.cam.com/vxipconfig.html

This should run despite of the device's vendor, since some are providing extra tools which can help you on this..

>know that using JavaAPI we just will get the MAC ADRESS

Don't get me wrong, but I am not aware of a way Java can obtain the MAC address.. This only can be done through some JNI calls.. It is much the same with the JavaScript - no way to get it from it..

Best Regards,

Lalo Ivanov

Answers (5)

Answers (5)

Former Member
0 Kudos

Hi Bruno,

are you running MI on the client? Then it should not be a problem to install this additional C# control on the client and call it via JNI. Or you could try to use your approach - but as I said, not every phone has IPCONFIG installed.

On the other side - without installing anything on the device - you will not be able to retrieve the MAC address. So if you access your app just via the browser I have no idea how you could access the MAC address - but then the question is: what are you doing and could you perhaps find another approach. IF interested send me a mail, so we could discuss this outside.

Regards,

Oliver

Former Member
0 Kudos

Hi Oliver,

Our application is running on WEB AS. We toke of MI Client.

So users access the application by a URL. For securities reasons, the application probably won't possible access MAC Address of the client.

Thanks for your help.

Regards,

Bruno

Former Member
0 Kudos

Hi Bruno,

well, I am a little confused. You say you are able to get the MAC address on a XP machine? If you really access the machine only by browser, this should not be possible in my understanding.

So my simple question still is: how have you done that?

On the Server you will normally not receive the MAC adress if somewhere between server and client is a router or anything like that involved. On the server you will get only MAC address form the last network card in the line. So I would be interested in: how have you done that with just using Javascript AND without touching any security issues.

Ok, my suggestion was, to install a Control. Lets say it in old words. A while ago on a PC you installed an ActiveX control - for example to run flash in a browser. You can do similar stuff on a PDA. So you could create an ActveX control - today I think it is called control - for the PDA.

BUT: The user has to allow this installation and I think this is the problem here! Who wants to install software just while he uses a website, if it is not his companys page or he has any benefit from that.

Anyhow: to get a MAC address on WinCE - here you find the code for that:

http://www.pdastreet.com/forums/archive/index.php/t-30413.html

Embed it into a WinCE Control, install that Control on the client - and then access it from the Website - this should give you the requestied informations.

Hope that switches on the light a bit.

Regards,

Oliver

Former Member
0 Kudos

Hi Oliver,

To get MAC Address by JavaScript on Windows XP i use this link:

http://www.devarticles.com/c/a/JavaScript/Advanced-JavaScript-with-Internet-Explorer-Retrieving-Netw...

I will search about the "Control" how mencioned for you.

Thanks for your help.

Regards,

Bruno

Former Member
0 Kudos

Hi Bruno,

thanks a lot for this answer. Well, he does it exactly as I mentioned - he uses an ActiveX control on the page and gets the data from there. With pure JS it would not be possible to retrieve the data you ask for.

As you see in the lines that sart with ""var locator..."" - there he uses the build in control WbemScripting.SWbemLocator.

With the following lines he just prints the information he received.

The bad thing in your case: this ActiveX Control he is using is not available on the PDA and as I am aware of the JS implementation on the PDA is more strict then on a PC. This means, you have to develop the code completely in C# and just have a get method, that delivers the MAC addres - unfortunately. I will have a look into the documentation of the CE API if I can find anything similar that you could use in the browser without developing, but I think there is no ready to use control.

Have fun.

Regards,

Oliver

Former Member
0 Kudos

Hi Oliver,

Thanks one more time for your attention.

It's true, it isn't possible to get MAC Address just with JavaScript.

But we have a problem. Our application was built with Java. To use your code with C#, we will have to create a DLL and call this DLL using JNI, but probably the application server don't get access this DLL on Client...

But if was to use C#, we could use Java to get MAC Address, using Runtime.getRuntime().exec("cmd.exe -c ipconfig -all").

Any more idea?

Regards,

Bruno

Former Member
0 Kudos

Hi Bruno,

Tough work, even if you succeed to overgo the security..

For example my ipconfig -all displays the physical addresses of 1) my local ethernet adapter used for company LAN, 2) physical address used in the Wi-FI connection and 3) physical address used in the connection via ActiveSync to Windows Mobile-based device..

You can try playing with the 'arp -a' command as well, but anyway I am not sure if you will got 100% reliable interpreting of the output :-((

Best Regards,

Lalo

Former Member
0 Kudos

Hi Lalo,

But executing this command line, i got only the informations about the server and don't the client.

Any more idea?

Thanks.

Bruno

Former Member
0 Kudos

hi bruno,

you can refer to this forum thread at sun.

regards

jo

Former Member
0 Kudos

Guys,

Thanks for your attention.

Lalo,

We need to obtain MAC Address by Java. Could be with

Runtime.getRuntime().exec("cmd.exe -c ipconfig -all");

for example. But our client is a browser and i think for security reasons, I think it's not possible. What do you think?

Oliver,

I didn't understand with "install a control on the PDA to get the MAC address and then get the value on the WebPage by using this control". Could you be more clear?

The application will be accessed only the client network.

Jo,

Our client isn't installed. The users access the application by a browser. Any more idea?

Thanks again.

Regards,

Bruno

Former Member
0 Kudos

Hi Bruno,

as MAC address is on ISO 2 I think and you can only access ISO 6-8 from JS, I am a little surprised you say you get the MAC address on PC client with simple JS. Using some Java and JavaScript on the WebPage - well, yes, then it is possible on PC - that is correct.

So I guess you have an intranet App running?

On a PDA it is not possible to run Java Applets just from the WebPage, because you need some third party software to do that. JavaScript is possible on PDA, but the syntax chnaged from Version to Version and between WinMobile 5 and WinMobile 6 there is another Syntax change in handling Objects - so please be careful in unsing JS on PDA.

the only option you have to do that is to install a control on the PDA to get the MAC address and then get the value on the WebPage by using this control.

You do not say how you connect to the Server. Via ActveSync, GPRS,....? There are several other ways possible on the server to find out the unique ID of the device - but this is heavily dependend to your connection settings.

And if you use GPRS - to have it save, you could ask your Mobile Telephone company to route the devices via a secure VPN connection directly into your network. Only your devices are routed and no others have access to your network. The Telco takes care of that! We did that with some customers and this was the easiest and safest option for them.

Hope this help to solve your problem.

Have fun,

Oliver