开发者网络 动网主机 支持论坛 邮局 帮助
当前位置:网络学院ASP技术客户端相关 → 获得客房端的MAC(Media Access Control)地址
获得客房端的MAC(Media Access Control)地址
日期:2000年10月10日 作者: 人气:     [ ]

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


  
Can't 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 you're Not trying To hit on the same
    pc it's 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:
Can't 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
    LAN's. Firewalls and Proxy's will be an issue
    depending what side of them you're coding for.
    ' By: Jerry Aguilar
    '
    '
    ' Inputs:None
    '
    ' Returns:Returns the client IP and MAC
    '     address.
    '
    'Assumes:You can't 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
    '     r's 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>

(出处:)

相关文章:
 
·SQL Server 2000 SP4发布
·Sql Server 2005最新CTP简介及截图
·微软发布数据库新测试版 最终版明夏登场
·网络社区论坛即将成为互联网下一热点
·SET NOCOUNT的用法和注意事项
·全正则的检测IP是否合法的函数
·判断一个access数据库中某个表是否存在的方法
·用Asp生成条形码
·数字小写到英文大写的转换
·在不支持FSO的服务器上使用XMLDOM创建HTML文件
相关软件:
 
·拓域会员核心系统 v1.02
·深博贴吧(仿百度)双数据库版 v1.5
·通用草稿自动保存系统SipoAutoSaver v2.0
·BJXSHOP网上开店专家 v6.0 SP1 Build 20060118
·企业网站智能管理系统(TZIMS) v1.5
·bzmtv v1.0 正式版
·宜兴二级域名申请系统SQL版
·Mslove交友系统 v3.0
·亿人通讯录 v3.0
·深博贴吧(仿百度)双数据库版 v1.0
说明:本站部分内容收集于网络,如有侵犯您的权益请来信告知,我们会第一时间进行处理,谢谢
 → 特别推荐
 → 热点TOP10

关于本站 | 诚聘英才 | 业务合作 | 联系我们 | 广告合作 | 收藏本站

海口动网先锋网络科技有限公司版权所有
Copyright ? 2000 - 2003 AspSky.Net
中华人民共和国电信与信息服务业务经营许可证编号 琼 ICP 020077