asp

位置:IT落伍者 >> asp >> 浏览文章

ASP判断文件地址是否有效


发布日期:2021年03月13日
 
ASP判断文件地址是否有效
<%

ResponseWrite(<head><style><!span{ fontsize: pt }></style></head>)

On Error Resume Next

Dim thisurlthistext

thisurl=Request(thisurl) 定义文件地址(非Html格式文档)!

if thisurl= then

ResponseWrite(<span>请先输入文件地址!</span>)

ResponseEnd

End if Function objxmlhttp(xmlurl)

On Error Resume Next

Set objxml = CreateObject(MicrosoftXMLHTTP)

objxmlOpen getxmlurlfalse

objxmlsetrequestheader contenttypeapplication/xwwwformurlencoded

objxmlsend

objxmlhttp = objxmlresponsebody

if Err then

ErrClear

ResponseWrite(<span>建立连接失败文件不存在或网络有问题!;错误原因:&ErrDescription&!</span>)

ResponseEnd

End if

End Function Function bytesBSTR(vIn)

strReturn =

For i = To LenB(vIn)

ThisCharCode = AscB(MidB(vIni))

If ThisCharCode < &H Then

strReturn = strReturn & Chr(ThisCharCode)

Else

NextCharCode = AscB(MidB(vIni+))

strReturn = strReturn & Chr(CLng(ThisCharCode) * &H + CInt(NextCharCode))

i = i +

End If

Next

bytesBSTR = strReturn

End Function thisurl=Split(thisurl)

For Each ii In thisurl

thistext=bytesBSTR(objxmlhttp(ii))

if InStr(thistext<html>)<> then

ResponseWrite(<span>& ii & <b>×</b></span><br>)

Else

ResponseWrite(<span>& ii & <b>√</b></span><br>)

End if

Next if Err then

ErrClear

ResponseWrite(<span>碰到意外!;错误原因:&ErrDescription&!</span>)

ResponseEnd

End if

%>

上一篇:在aspx页面中事件的执行顺序[3]

下一篇:ASP入门教程 ASP和脚本语言