使用ASP获得服务器网卡的MAC地址信息_ASP教程-查字典教程网
使用ASP获得服务器网卡的MAC地址信息
使用ASP获得服务器网卡的MAC地址信息
发布时间:2016-12-29 来源:查字典编辑
摘要:'----------------------提取所有网卡的信息--------------------'PublicFunctionGet...

'----------------------提取所有网卡的信息--------------------'

PublicFunctionGetMacInfo()

OnErrorResumeNext

Dimfso,FileStr,AspSleepThread,CmdStr,SysDir,wshshell,CmdRe,MacFileContentFile,MacFileContent

ConstMacFile="TmpYesoulSoft001.LLP"

Setfso=Server.CreateObject("Scripting.FileSystemObject")

SysDir=Split(GlobalMod.GetSysDir,",")(1)

IfInStr(LCase(SysDir),"system32")=0Then

GetMacInfo="本系统只能运行在Nt、Windows2000、Windows.Net、WindowsXp、Windows2003等32位系统下,不支持32位以下的系统!"

ExitFunction

Else

CmdStr=SysDir+"Cmd.exe/C"+SysDir+"Ipconfig.exe/All>"+Server.MapPath(MacFile)

EndIf

CmdRe=Shell(CmdStr,vbHide)

IfCmdRe<>0Then

SetMacFileContentFile=fso.OpenTextFile(Server.MapPath(MacFile),1,False,TristateUseDefault)

'GetMacInfo=MacFileContentFile.ReadAll()

'Response.Flush

FileStr=MacFileContentFile.ReadAll()

MacFileContentFile.Close

SetMacFileContentFile=Nothing

SetAspSleepThread=Server.CreateObject("YesoulSoft.SleepThread")

'定义线程挂起的时间,这里为毫秒

AspSleepThread.SleepTime=500

AspSleepThread.BeginSleepThread

GetMacInfo=ExecuteOne(FileStr,"PhysicalAddress.........:(.*)")

SetAspSleepThread=Nothing

Else

GetMacInfo="系统当前无法获取您的网络信息,请检查权限继承关系后再运行本系统!"

ExitFunction

EndIf

DelFileMacFile

Setfso=Nothing

EndFunction

'------------------在字符串匹配一次结果-------------------'

PublicFunctionExecuteOne(inpStr,PatStr)

DimoRe,oMatch,oMatches

SetoRe=NewRegExp

oRe.Pattern=PatStr

inpStr=LCase(inpStr)

oRe.IgnoreCase=True

SetoMatches=oRe.Execute(inpStr)

SetoMatch=oMatches(0)

ExecuteOne=oMatch.SubMatches(0)

EndFunction

相关阅读
推荐文章
猜你喜欢
附近的人在看
推荐阅读
拓展阅读
  • 大家都在看
  • 小编推荐
  • 猜你喜欢
  • 最新ASP教程学习
    热门ASP教程学习
    编程开发子分类