Use network information such as the server network card in the ASP (transfer)

xiaoxiao2021-03-06  26

http://blog.9cbs.net/hnhslsz/archive/2004/12/31/235741.aspx' ---------------------- extract all NIC's information--------------------'

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! "'Www.knowsky.com 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.createo bject ( "YesoulSoft.SleepThread") 'is defined thread suspends time, here, milliseconds AspSleepThread.SleepTime = 500 AspSleepThread.BeginSleepThread GetMacInfo = ExecuteOne (FileStr, "Physical Address:.......... (*) ") Set aspsleepthread = 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 '------------------ in the string matching the result ------------ ------- '

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 code can only get the MAC address of the first network card, as for DNS, gateways, etc. You can give a two.

转载请注明原文地址:https://www.9cbs.com/read-65142.html

New Post(0)