·您现在的位置: 云翼网络 >> 文章中心 >> 网站建设 >> 网站建设开发 >> ASP网站建设 >> ASP一个检测链接是否正常的函数

ASP一个检测链接是否正常的函数

作者:佚名      ASP网站建设编辑:admin      更新时间:2022-07-23

<%
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="http://code.dlstu.cn"

if urlChk(sUrl) then
    response.write(sUrl&"(可以正常访问!)")
else
    response.write(sUrl&"(页面打开错误!)")
end if
%>