优秀的软件开发团队:深圳升蓝软件 数据库开发 .Net技术  |  ASP技术 PHP技术 JSP技术 应用技术类     
热门推荐
升蓝OA办公自动化系统
基于.Net技术的网络
协同办公环境
 
ASP基础
数据库相关
安全加密
全文检索
ASP应用
打印相关
客户端相关
XML相关
系统相关
正则表达式
ASP技巧
组件开发
脚本编码
FSO专题
邮件相关
远程脚本
性能优化
 
相关链接
深圳升蓝软件:系统集成、办公自动化平台、电子商务、电子政务、Web数据库、企业网站、游戏、手机应用程序、CDMA软件、电子出版物等,为客户提供优秀的解决方案
 
升蓝(www.hi-blue.com)为企业管理、政府办公提供成熟的、易于实施的IT技术服务,我们的解决方案包括OA办公自动化系统CRM客户关系管理系统ERP企业生产管理和订单管理系统电子政务系统、知识管理系统、企业门户、商业智能、工程项目管理等等...
 
电子政务解决方案
塑料/橡胶管理系统
知识管理系统简介
多媒体光盘方案
ERP企业资源管理
订单计划管理系统
PM工程项目管理系统
会员管理系统
相关资料下载
OA办公自动化系统
CRM客户关系管理系统
在线试用版本说明
OA 系统的用户手册
 
 
 
 
升蓝开发团队 > 技术资料 > ASP技术 > 客户端相关 : 获得客房端的MAC(Media Access Control)地址

获得客房端的MAC(Media Access Control)地址


March 25,2004

     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>
数据库开发 | .Net技术 | ASP技术 | PHP技术 | JSP技术 | 应用技术类 | 升蓝开发小组
Copyright ? 2001-2004 Shenzhen Hi-blue Software Team 升蓝开发小组 All rights reserved