For the preface, the author has to do a MIS system development due to the time period, because the MIS is a non-free software, so the corresponding registration module is also required to complete the system development, because the system of the B / S structure, So in registration I chose a unique network card MAC address on the selection. Gossip less, cut into the topic below. Because the system is commercial software, only the following code contains only code ideas, and simple implementation code, you can use it freely according to the code, or you can learn with me.
'-------------------------- Extract all NIC information ------------------ ------ '
'------ Powered by YESOUL SOFT is not fast, please keep this information http://www.772.cn ---------' public function getMacInfo () on Error Resume next
Dim fso, FileStr, AspSleepThread, CmdStr, SysDir, wshshell, CmdRe, MacFileContentFile, MacFileContent Const MacFile = "TmpYesoulSoft001.LLP" Set fso = Server.CreateObject ( "Scripting.FileSystemObject") SysDir = Split (GlobalMod.GetSysDir, "," (1) if INSTR (LCase (sysdir), "System32") = 0 THEN getMacInfo = "This system can only run in 32-bit systems such as NT, Windows 2000, Windows. Net, Windows XP, Windows 2003, do not support 32-bit system! "Exit function else cmdstr = sysdir " /cmd.exe / c " sysdir " /ipconfig.exe / all> " server.mappath (macfile) end if cmdre = shell (cmdstr, vbhide ) If CmdRe <> 0 Then Set MacFileContentFile = fso.OpenTextFile (Server.MapPath (MacFile), 1, False, TristateUseDefault) 'GetMacInfo = MacFileContentFile.ReadAll ()' Response.Flush FileStr = MacFileContentFile.ReadAll () MacFileContentFile.Close Set MacFileContentFile = Nothing set aspsleepthread = Server.createObject ("Yesoulsof T.Sleepthread ") 'Defines the time hangs hangs, here for milliseconds aspsleepthread.sleeptime = 500 aspsleepthread.beginsleepthread getMacInfo = executeone (FileStr," physical address............ *) ") SET AskEEPTHREAD = Nothing else getmacInfo = "The system is currently unable to get your network information, please check the permission inheritance and then run this system! "EXIT FUNCTION END IF DELFILE MACFILE SET FSO = Nothing End Function '------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ -------------------- '
Public Function ExecuteOne (inpStr, PatStr) Dim oRe, oMatch, oMatches Set oRe = New RegExp oRe.Pattern = PatStr inpStr = LCase (inpStr) oRe.IgnoreCase = True Set oMatches = oRe.Execute (inpStr) Set oMatch = oMatches (0 EXECUTEONE = omatch.submatches (0) End Function Welcome everyone to contact me, this code structure is simple, please use it free to adopt and play, if you have better ideas, please tell me in time, QQ: 115269 email: Ycsyb@ycsyb.com
The getMacinfo function in the code can only get the MAC address of the first network card. As for the DNS, gateway, etc., you can give it three.