強(qiáng)制刷新和判斷文件地址是否有效
當(dāng)前位置:點(diǎn)晴教程→知識(shí)管理交流
→『 技術(shù)文檔交流 』
強(qiáng)制刷新網(wǎng)頁(yè) <% '強(qiáng)制性刷新隨機(jī)驗(yàn)證碼 '讓隨機(jī)驗(yàn)證碼每次按IE的后退按鈕時(shí),返回登錄頁(yè)面的隨即碼都自動(dòng)刷新, Response.expires=-1 Response.AddHeader"pragma","no-cache" Response.AddHeader"cache-control","no-store" %> 判斷文件地址是否有效 <% Response.Write("<head><style><!--span{ font-size: 14px }--></style></head>") On Error Resume Next Dim thisurl,thistext thisurl=Request("thisurl") '定義文件地址(非Html格式文檔)! if thisurl="" then Response.Write("<span>請(qǐng)先輸入文件地址!</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>建立連接失敗,文件不存在或網(wǎng)絡(luò)有問題!;錯(cuò)誤原因:"&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 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>碰到意外!;錯(cuò)誤原因:"&Err.Description&"!</span>") Response.End End if %> 該文章在 2011/2/16 9:14:12 編輯過 |
關(guān)鍵字查詢
相關(guān)文章
正在查詢... |