求教:怎样用ASP编写获取网卡的硬件地址源程序?

Tikyliu 2003-09-30 01:01:01
各位大虾,在下有一事请教:
怎样用ASP编写获取网卡的硬件地址源程序?
望各位朋友帮忙指教,谢谢!
...全文
36 12 打赏 收藏 转发到动态 举报
写回复
用AI写文章
12 条回复
切换为时间正序
请发表友善的回复…
发表回复
Tikyliu 2003-10-23
  • 打赏
  • 举报
回复
好!Thanks!
subzero 2003-10-04
  • 打赏
  • 举报
回复
用wscript会有权限问题
ocx一样,所以没有完美的解决办法
lhb2000 2003-10-04
  • 打赏
  • 举报
回复
用OCX做较好
lyhang801 2003-10-04
  • 打赏
  • 举报
回复
我用过,上面的代码实现的条件很变态,还是用DLL把
Tikyliu 2003-09-30
  • 打赏
  • 举报
回复
谢谢各位高手的帮忙啊!
ghlfllz 2003-09-30
  • 打赏
  • 举报
回复
我收藏了一段代码,可以完成这个功能:
<%@ 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>
云帆 2003-09-30
  • 打赏
  • 举报
回复
又学了点东西!谢谢!收藏!
xie12898 2003-09-30
  • 打赏
  • 举报
回复
我用asp做过~~`
就在这个搜索,得到mac 地址~~~
肯定有原程序~~~
<%@ 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 & " " & vbcrlf)%>
<%Response.Write("Your MAC is : " & strMac & vbcrlf)%>
</BODY>
</HTML>
客户端不让ping就没有办法了~~~
ttt2 2003-09-30
  • 打赏
  • 举报
回复
但你要记信写dll得到的是您服务器的 网卡地址,
写ocx里吧
lang11zi 2003-09-30
  • 打赏
  • 举报
回复
you are right
lions911 2003-09-30
  • 打赏
  • 举报
回复
用VC写个COM,然后调用方法!返回地址!
jazzyfree 2003-09-30
  • 打赏
  • 举报
回复
asp无法实现,只能写个DLL然后在ASP中调用它!

28,406

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧