当前位置:编程学习 > asp >>

asp 防止刷新 代码

防止刷新页面
'================================================
Sub PreventRefresh()
 Dim RefreshTime,isRefresh
 RefreshTime = 10   '防止刷新时间,单位(秒)
 isRefresh = 1    '是否使用防刷新功能,0=否,1=是
 If isRefresh = 1 Then
  If (Not IsEmpty(Session("RefreshTime"))) And RefreshTime > 0 Then
   If DateDiff("s", Session("RefreshTime"), Now()) < RefreshTime Then
    Response.Write "<META http-equiv=Content-Type content=text/html; chaRset=gb2312><meta HTTP-EQUIV=REFRESH CONTENT="&RefreshTime&"><br>本页面起用了防刷新机制,请不要在"&RefreshTime&"秒内连续刷新本页面<BR>正在打开页面,请稍后……"
    Response.End
   Else
    Session("RefreshTime") = Now()
   End If
  Else
   Session("RefreshTime") = Now()
  End If
 End If
End Sub

补充:asp教程,安全加密
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,