當(dāng)前位置:首頁文章首頁 IT學(xué)院 IT技術(shù)

ASP如何禁止刷新當(dāng)前頁面

作者:  來源:  發(fā)布時(shí)間:2011-5-31 15:19:39  點(diǎn)擊:

下面給大家介紹兩種關(guān)于ASP禁止刷新當(dāng)前頁面的方法,希望能幫助到大家。

方法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>本頁面起用了防刷新機(jī)制,請(qǐng)不要在<b><font color=ff0000>"&shuaxin_time&"</font></b>秒內(nèi)連續(xù)刷新本頁面<BR>正在打開頁面,請(qǐng)稍候……"
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("防刷新,兩秒后自動(dòng)跳轉(zhuǎn)")
Response.End
End IF
Response.Cookies("oesun")("vitistime")=Now()
%>

文章評(píng)論

軟件按字母排列: A B C D E F G H I J K L M N O P Q R S T U V W X Y Z