ASP to determine whether the file address is valid!

Source: Internet
Author: User
Tags chr end valid
<%
' Original author: Xiao Yi qq:52093
Response.Write ("On Error Resume Next
Dim Thisurl,thistext
Thisurl=request ("Thisurl") ' defines the file address (non-HTML format document)!
If Thisurl= "" Then
Response.Write ("<span> Please enter the file address!</span> first")
Response.End
End If

Function objXmlHttp (XmlUrl)
On Error Resume Next
Set Objxml = CreateObject ("Microsoft.XMLHTTP")
Objxml. Open "Get", Xmlurl,false
Objxml.setrequestheader "Content-type", "application/x-www-form-urlencoded"
Objxml.send
objXmlHttp = Objxml.responsebody
If Err Then
Err.Clear
Response.Write ("<span> failed to establish connection, file does not exist or network problem!; Error reason: "&Err.Description&"! </span> ")
Response.End
End If
End Function

Function Bytes2bstr (vIn)
Strreturn = ""
For i = 1 to LenB (vIn)
Thischarcode = AscB (MidB (vin,i,1))
If Thischarcode < &h80 Then
Strreturn = Strreturn & Chr (Thischarcode)
Else
Nextcharcode = AscB (MidB (vin,i+1,1))
Strreturn = Strreturn & Chr (CLng (thischarcode) * &h100 + CInt (nextcharcode))
i = i + 1
End If
Next
Bytes2bstr = Strreturn
End Function

Thisurl2=split (Thisurl, ",")
For all II in THISURL2
Thistext=bytes2bstr (objXmlHttp (ii))
If InStr (Thistext, "Response.Write ("<span>" & II & "<b>x</b></span><br>")
Else
Response.Write ("<span>" & II & "<b>√</b></span><br>")
End If
Next

If Err Then
Err.Clear
Response.Write ("<span> encountered an accident!; Error reason: "&Err.Description&"! </span> ")
Response.End
End If
%>



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.