例程:用ASP判断文件地址是否有效_ASP教程

编辑Tag赚U币
教程Tag:暂无Tag,欢迎添加,赚取U币!

推荐:ASP进阶:用ASP判断文件地址是否有效
<% Response.Write("<head><style><!--span{ font-size: 9pt }--></style></head>") On Error R

以下为引用的内容:
<%
Response.Write("<head><style><!--span{ font-size: 9pt }--></style></head>")
On Error Resume Next
Dim thisurl,thistext
thisurl=Request("thisurl") '定义文件地址(非Html格式文档)!
if thisurl="" then
Response.Write("<span>请先输入文件地址!</span>")
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>建立连接失败,文件不存在或网络有问题!;错误原因:"&Err.Description&"!</span>")
Response.End
End if
End Function
'mb5u.com
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 Each ii In thisurl2
thistext=bytes2BSTR(objxmlhttp(ii))
if InStr(thistext,"<html>")<>0 then
Response.Write("<span>"& ii &" <b>×</b></span><br>")
Else
Response.Write("<span>"& ii &" <b>√</b></span><br>")
End if
Next

if Err then
Err.Clear
Response.Write("<span>碰到意外!;错误原因:"&Err.Description&"!</span>")
Response.End
End if
%>

分享:怎么判断一个对象是否已被释放
以下为引用的内容: <% Dim conn'声明 Set conn = Server.CreateObject("ADODB.Connection")'创建 '使用 Set conn = Nothing'释放 %>

来源:模板无忧//所属分类:ASP教程/更新时间:2008-08-22
相关ASP教程