熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> .NET編程 >> 正文

ASP判斷文件地址是否有效

2022-06-13   來源: .NET編程 
<%
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
%>

From:http://tw.wingwit.com/Article/program/net/201311/15080.html
    推薦文章
    Copyright © 2005-2022 電腦知識網 Computer Knowledge   All rights reserved.