设为首页   加入最爱           最新更新:全方位英文文章资料库
 
资料坊搜索: 标题 全文     
获得客户端的MAC(Media Access Control)地址
   首页>>YesizeCOM>>电脑技能坊>>ASP>>正文       
 
广告招租,e-mail:yesize@hotmail.com

广告招租,e-mail:yesize@hotmail.com


Get the clients MAC(Media Access Control) address, a hardware address that uniquely identifies each
node of a network. Works great on LANs. Firewalls and Proxys will be an issue depending what side of
them youre coding for.


Cant Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!

 

**************************************
for :MAC address
**************************************
This code is AS IS! I had a need For it on a
project I was working On and found almost no info
anywhere On what I needed To accomplish. If it
helps you, great! If it does Not work For you:
1.Make sure youre Not trying To hit on the same
pc its on.
2.Comment out where the file gets deleted
(fso.deletefile "c:\" & strIP & ".txt"), To view
some potential Error info.
3.Have fun debugging :) (I did)

code:
Cant Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!

 

**************************************
Name: MAC address
Description:Get the clients MAC(Media
Access Control)
address, a hardware address that uniquely
identifies Each node of a network. Works great on
LANs. Firewalls and Proxys will be an issue
depending what side of them youre coding for.
By: Jerry Aguilar


Inputs:None

Returns:Returns the client IP and MAC
address.

Assumes:You cant navigate to it runnin
g PWS on the same
pc but If you are running PWS, you can navigate
To it from another pc on the same lan (it does
Not like 127.0.0.1)

Side Effects:None

Warranty:
code provided by Planet Source Code(tm)
(www.Planet-Source-Code.com) as is, wi
thout warranties as to performance, fitn
ess, merchantability,and any other warra
nty (whether expressed or implied).
Terms of Agreement:
By using this source code, you agree to
the following terms...
1) You may use this source code in per
sonal projects and may compile it into a
n .exe/.dll/.ocx and distribute it in bi
nary format freely and with no charge.
2) You MAY NOT redistribute this sourc
e code (for example to a web site) witho
ut written permission from the original
author.Failure to do so is a violation o
f copyright laws.
3) You may link to this code from anot
her website, provided it is not wrapped
in a frame.
4) The author of this code may have re
tained certain additional copyright righ
ts.If so, this is indicated in the autho
rs description.
**************************************

<%@ LANGUAGE="VBSCRIPT"%>
<%
strIP = Request.ServerVariables("REMOTE_ADDR")
strMac = GetMACAddress(strIP)
strHost = Request.ServerVariables("REMOTE_HOST")
Function GetMACAddress(strIP)
Set net = Server.CreateObject("wscript.network")
Set sh = Server.CreateObject("wscript.shell")
sh.run "%comspec% /c nbtstat -A " & strIP & " > c:\" & strIP & ".txt",0,true
Set sh = nothing
Set fso = createobject("scripting.filesystemobject")
Set ts = fso.opentextfile("c:\" & strIP & ".txt")
macaddress = null
Do While Not ts.AtEndOfStream
data = ucase(trim(ts.readline))
If instr(data,"MAC ADDRESS") Then
macaddress = trim(split(data,"=")(1))
Exit Do
End If
loop
ts.close
Set ts = nothing
fso.deletefile "c:\" & strIP & ".txt"
Set fso = nothing
GetMACAddress = macaddress
End Function
%>
<HTML>
<HEAD>
<TITLE>Say Hello To the MAC MAN</TITLE>
</HEAD>
<BODY>
<%Response.Write("Your IP is : " & strIP & "<BR>" & vbcrlf)%>
<%Response.Write("Your MAC is : " & strMac & vbcrlf)%>
</BODY>
</HTML>


上一篇:制作一个简单的服务器端控制 下一篇:让Session对象在不同域名下实现共享

版权说明:作品来源于网上,版权归作者所有,如果无意中侵犯了您的版权,请来信告知,本站将在3个工作日内删除。yesize@hotmail.com
  热门小游戏分类 
射击小游戏 连连看小游戏
台球小游戏 成人小游戏
CS小游戏 化妆小游戏
赛车小游戏 休闲小游戏
篮球小游戏 换装小游戏
儿童小游戏 牛牛小游戏
麻将小游戏 冒险小游戏
美媚小游戏 益智小游戏
体育小游戏  
Society Recreation & Sports
Travel & Leisure Communications
Vehicles Computers
Fashion Arts & Entertainment
Reference & Education Disease & Illness
Writing & Speaking Politics
Product Reviews Food & Beverage
Finance Internet Business
Self Improvement Home & Family
Health & Fitness Business
最新更新内容
警惕“公务员报考热”背
公务员考试不是丈母娘考
一名新公务员的自白:我
公务员考脑筋急转弯与挂
北努斗:2006行政能力测
大讨论:06行测BT题目大
过来人回忆:当年,我也
一家之言:公务员热折射
公务员考试申论要是有正
数十万大学生走进公务员
      粤ICP备05005424         Copyright ©2000 - 2004 Yesize.COM