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

来源:岁月联盟 编辑:zhuzhu 时间:2009-05-08
<%
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
%>