判断网址是否存在
ASP 2008/5/27 8:22:21 点击:不统计
关键词:判断网址是否存在,判断网址是否正确,判断网址,判断网址
<%
function isurl(url1,url2)
Set xmlHttp = CreateObject("Msxml2.XMLHTTP") '创建对象
On Error Resume Next '错误处理
xmlHttp.Open "POST", url1, False '用 "POST" 方法异步打开连接
xmlHttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded" '发送表单数据
xmlHttp.Send '向服务器发送 HTTP 请求
If Err.Number = 0 Then '如果成功
isurl=url1
Else
isurl=url2 '如果错误
End If
Set xmlHttp = nothing '释放对象
end function
'试验
aa="http://xxx.forasp.cn"
bb="http://www.forasp.cn"
response.write isurl(aa,bb)
%>
·上一篇:asp图片上传漏洞 >> ·下一篇:asp判断浏览器 >>