以文本方式查看主题

-  ╋艺 镇╋  (http://wdystv.com/bbs/index.asp)
--  ┣◇网站建设&Web语言  (http://wdystv.com/bbs/list.asp?boardid=4)
----  ASP防刷新代码  (http://wdystv.com/bbs/dispbbs.asp?boardid=4&id=52)

--  作者:乐魔舞
--  发布时间:2007/12/27 11:52:18
--  ASP防刷新代码

法一:
<%
Dim URL
If DateDiff("s",Request.Cookies("oesun")("vitistime"),Now())<2 Then
    URL=Request.ServerVariables("Http_REFERER")
    Response.Write("<meta http-equiv=""refresh"" c&URL&""">")
    Response.Write("防刷新,两秒后自动跳转...")
    Response.End
End IF
Response.Cookies("oesun")("vitistime")=Now()
%>

法二:
<%
If Request.Cookies("terry.jsjt")("norefresh")<>"" Then
    If DateDiff("s",Request.Cookies("terry.jsjt")("norefresh"),Now())<5 Then
        If Request.ServerVariables("QUERY_STRING")="" Then
            Response.Write("<meta http-equiv=""refresh"" c&Request.ServerVariables("URL")&""">")
        Else
            Response.Write("<meta http-equiv=""refresh"" c&Request.ServerVariables("URL")&"?"&Request.ServerVariables("QUERY_STRING")&""">")
        End If
        Response.Write("防刷新,三秒后自动跳转...")
        Response.End
    End IF
End if
Response.Cookies("terry.jsjt")("norefresh")=Now()
%>

[此贴子已经被admin于2011-8-6 17:53:47编辑过]