打印本页〗〖打印选项
用ASP判断链接是否有效

这段代码的作用是先检测这个程序是否可以下载,如果可以下载,就自动下载,如不可以下载,即显示程序中的提示文字!


最下面找到


'转向连接
response.redirect fileurl


修改为

'转向连接
if fileurl<>"" then
''判断是否有效
Function IsValidUrl(url)
        Set xl = Server.CreateObject("Microsoft.XMLHTTP")
        xl.Open "HEAD",url,False
        xl.Send
        IsValidUrl = (xl.status=200)
End Function

If IsValidUrl(""&fileurl&"") Then
response.redirect fileurl
Else
Response.Write "由于下载用户过多,程序检测到文件暂时无法下载,请更换其他下载地址。"
End If
end if




文章作者:未知