I'm fairly familiar with the language but this concept is a puzzle to me. I am wanting ot check if the server on which the script is running can access the internet for development so let's say if I am just working on the site offline on my own server with everything I need but internet access. Catch my drift? Thank you.
You can try and ping a site like this: (not tested)
url = "www.google.com"
Set objWShell = CreateObject("WScript.Shell")
Set objCmd = objWShell.Exec("ping " & url)
strPingResult = objCmd.StdOut.Readall()
set objCmd = nothing
set objWShell = nothing
strStatus = "offline"
if InStr(strPingResult,"TTL=") > 0 then strStatus = "online"
response.write url & " is " & strStatus
response.write ".<br>" & replace(strPingResult,vbCrLf,"<br>")
不知道我是否理解正确,但是您可以为此使用Session对象/ Global.asa文件> Session_OnStart
和Session_OnEnd
。
Check out the answer I posted on this very similar question:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.