Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Ho do I retrieve a systems Mac Address 1

Status
Not open for further replies.

StuWilson

Programmer
Oct 10, 2001
9
0
0
CA
I know ho to retrive the IP address from a system but i need to get the mac address of a machine that is accessing a webpage. Help please
 
HI,

It is possible to get the mac address using ASP code but I have to tell you that this is not reliable 'coz we tried it. Some use proxy and the mac address of the server is what we get not the mac of the particular user who is accessing the web page. But anyway if you are really up to it I could send you the code.
 
Yes Renzy you can send me the code, I would appreciate it
 
We used this code also to track things, make the best out of it.

<%
strIP = Request.ServerVariables(&quot;REMOTE_ADDR&quot;)
strMac = GetMACAddress(strIP)
strHost = Request.ServerVariables(&quot;REMOTE_HOST&quot;)

Function GetMACAddress(strIP)
Set net = Server.CreateObject(&quot;wscript.network&quot;)
Set sh = Server.CreateObject(&quot;wscript.shell&quot;)
sh.run &quot;%comspec% /c nbtstat -A &quot; & strIP & &quot; > c:\&quot; & strIP & &quot;.txt&quot;,0,true
Set sh = nothing
Set fso = createobject(&quot;scripting.filesystemobject&quot;)
Set ts = fso.opentextfile(&quot;c:\&quot; & strIP & &quot;.txt&quot;)
macaddress = null
Do While Not ts.AtEndOfStream
data = ucase(trim(ts.readline))
If instr(data,&quot;MAC ADDRESS&quot;) Then
macaddress = trim(split(data,&quot;=&quot;)(1))
Exit Do
End If
loop
ts.close
Set ts = nothing
'fso.deletefile &quot;c:\&quot; & strIP & &quot;.txt&quot; 'Used to delete the temp file
Set fso = nothing
GetMACAddress = macaddress
End Function
%>
<HTML>
<HEAD>
<TITLE> MAC MAN</TITLE>
</HEAD>
<BODY>
<%Response.Write(&quot;Your IP is : &quot; & strIP & &quot;<BR>&quot; & vbcrlf)%>
<%Response.Write(&quot;Your MAC is : &quot; & strMac & vbcrlf)%>
</BODY>
</HTML>
 
Hi,

Any problems with the codes above? If you find it hard to figure out...I could help you.
 
No problem code works fine thanks. I needed it to track some stolen computers.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top