您现在的位置是:网站首页> 编程资料编程资料
asp下的一个检测链接是否正常的函数_应用技巧_
2023-05-25
240人已围观
简介 asp下的一个检测链接是否正常的函数_应用技巧_
Function urlChk(sUrl)
on error resume next
Set xmlHttp = Server.CreateObject("Microsoft.XMLHTTP")
xmlHttp.open "GET",sUrl,false
xmlHttp.send
if xmlHttp.Status <> 200 then
urlChk=false
else
urlChk=true
end if
End Function
sUrl="https://www.jb51.net"
if urlChk(sUrl) then
response.write(sUrl&"(可以正常访问)")
else
response.write(sUrl&"(访问不了)")
end if
on error resume next
Set xmlHttp = Server.CreateObject("Microsoft.XMLHTTP")
xmlHttp.open "GET",sUrl,false
xmlHttp.send
if xmlHttp.Status <> 200 then
urlChk=false
else
urlChk=true
end if
End Function
sUrl="https://www.jb51.net"
if urlChk(sUrl) then
response.write(sUrl&"(可以正常访问)")
else
response.write(sUrl&"(访问不了)")
end if
