Click here to Skip to main content
15,885,278 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hallo everyone,

I have been attempting to creat .Net applet. However, nothing is coming from the application I wrote. I couldn't see anything.

When I browse it with IE9, it displays some security settings to be changed, however after I got changed to these settings the same thing is displayed again.
This was the error I got when I browsed it(Error: Object doesn't support property or method 'MACAddress').
In mozila firefox, it returns nothing or showing nothing.

I need help.

Sample Code: this is how I tried to access a method found inside the class I wrote.
It is a jquery.

C#
$(document).ready(function () {
            alert($("[id$='myID']").MACAddress().toString());
        });


The dll file returns the MAC address of the client.
Thanks
Posted
Updated 7-May-11 23:18pm
v2
Comments
DaveAuld 8-May-11 5:59am    
It looks like you know the name of the object, so why use an 'endswith' JQuery selector? Simplifying the Jquery to a direct selection of the object first. $('#myID'), you need to then pass the object into a function to access its method.....i'm still looking at that bit.....:)

1 solution

Few possibilities
1- $("[id$='myID']") is not returning anything
2- if point # 1 is returning anything it doesn't contain MACAddress property
3- Point #1 is returning a collection of objects and MACAddress method belongs to an item not collection so fetch an object, if it should return only 1 object then get 0th index item and try accessing the item again.

break your statement in 2 parts
var extractedIDs = $("[id$='myID']");
if(extractedIDs != undefined)
  var macAddress = exgtractedIDs.MACAddress();


Add some breakpoint and debug it.

By the way what do you mean by "The dll file returns the MAC address of the client"?

Thanks,
Hemant
 
Share this answer
 
Comments
Yonathan1111 8-May-11 5:58am    
The dll file is called "MachinInformation.dll" and it is a library which contains a method called MACAddress() which returns a typd of string of MACAddress of the client.

Thank you for being helpful,
Hemant__Sharma 8-May-11 6:12am    
1- The MachinInformation.dll must be installed on every client where you are trying to access its properties. I hope you know that.
2- you must create an object at client end before accessing its properties with new ActiveX or Getobject etc. after that only you can access its properties and methods.

Add some code where you are creating an object of the type from this dll at client end.
Yonathan1111 8-May-11 6:38am    
Hi Hemant,
1. Yes, I know your first point. For the time being, it is me acting as both the client and the server.
2. But the second point you mentioned, I understand it, but I don't know how to do it.

If you can please help me with that. If possible, I want not to use the ActiveX control, suggest me with other options.

Thanks
Hemant__Sharma 8-May-11 7:45am    
Well there are two methods GetObject and CreateObject used to get and create an object. GetObject gets a reference of an object if it's already created and if it is not CreateObject creates new instance. you just need to make your assembly COM visible.

See the below link:
http://www.eggheadcafe.com/community/aspnet/3/10054371/how-to-get-client-mac-address.aspx

To better search you can google:
"accessing .net dll from javascript"

Thanks,
Hemant
Yonathan1111 9-May-11 1:33am    
Thank you Hemant,

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900