ASP检查网站链接是否正常的函数,这个函数可以查看网站的url地址,如果网站的url地址不正确,就会导致搜索引擎蜘蛛无法访问网站,从而影响网站的排名。
<%
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://www.code-123.com
if urlChk(sUrl) then
response.write(sUrl&"(可以正常访问!)")
else
response.write(sUrl&"(页面打开错误!)")
end if
%>