当前位置: 移动技术网 > IT编程>开发语言>Asp > ASP强制刷新网页和判断文件地址实例代码

ASP强制刷新网页和判断文件地址实例代码

2017年12月08日  | 移动技术网IT编程  | 我要评论

强制刷新网页

<%
 '强制性刷新随机验证码
 '让随机验证码每次按ie的后退按钮时,返回登录页面的随即码都自动刷新,
 response.expires=-1
 response.addheader"pragma","no-cache"
 response.addheader"cache-control","no-store"
%>

判断文件地址是否有效

<%
 response.write("")
 on error resume next
 dim thisurl,thistext
 thisurl=request("thisurl") '定义文件地址(非html格式文档)!
 if thisurl="" then
  response.write("请先输入文件地址!")
  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("建立连接失败,文件不存在或网络有问题!;错误原因:"&err.description&"!")
   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,"")<>0 then
   response.write(""& ii &" ×
")
  else
   response.write(""& ii &" √
")
  end if
 next
 if err then
  err.clear
  response.write("碰到意外!;错误原因:"&err.description&"!")
  response.end
 end if
%>

以上就是asp强制刷新网页和判断文件地址实例代码,希望对大家的学习有所帮助。

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网