ASP禁止刷新当前页的两种方法

王朝asp·作者佚名  2006-11-24
宽屏版  字体: |||超大  

方法1:

<%

Dim SplitReflashPage

Dim DoReflashPage

dim shuaxin_time

DoReflashPage=true

shuaxin_time=10

ReflashTime=Now()

if (not isnull(session("ReflashTime"))) and cint(shuaxin_time)>0 and DoReflashPage then

if DateDiff("s",session("ReflashTime"),Now())<cint(shuaxin_time) then

response.write "<META http-equiv=Content-Type content=text/html; charset=gb2312><meta HTTP-EQUIV=REFRESH CONTENT=3>本页面起用了防刷新机制,请不要在<b><font color=ff0000>"&shuaxin_time&"</font></b>秒内连续刷新本页面<BR>正在打开页面,请稍候……"

response.end

else

session("ReflashTime")=Now()

end if

elseif isnull(session("ReflashTime")) and cint(shuaxin_time)>0 and DoReflashPage then

Session("ReflashTime")=Now()

end if

randomize timer

regjm=int(rnd*8998)+1000

%>

方法2:

<%

Dim URL

If DateDiff("s",Request.Cookies("oesun")("vitistime"),Now())<2 Then

URL=Request.ServerVariables("Http_REFERER")

Response.Write("<meta http-equiv=""refresh"" content=""2;URL="&URL&""">")

Response.Write("防刷新,两秒后自动跳转")

Response.End

End IF

Response.Cookies("oesun")("vitistime")=Now()

%>

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
© 2005- 王朝网络 版权所有