session技术:防止用户频繁刷新页面
2016-04-20 19:05
671 查看
方法1,session技术:
程序代码
方法2,cookie技术:
程序代码
程序代码
<% 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,cookie技术:
程序代码
<% 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() %>
相关文章推荐
- N皇后
- IOS消息推送之APNS
- Java基础———第一弹
- 安卓开发——实现canvas.drawText文字水平且垂直居中
- 数据库相关易错点
- 组织部--不通过I/O操作来实现信息筛选
- C++ 简易的五子棋游戏 初学者
- iOS 类别和扩展(Categories和Extensions)
- 数据结构-stack基本操作
- 根据业务自己设计的.NET工厂模式架构
- android 自定义组合控件[有Demo]
- hue相关
- [BZOJ4538]网络
- SSO单点登录解决方案[转载]
- 24点
- iOS中事件传递 及手势操作
- zabbix 安装
- eclipse的debug模式启动缓慢 原因
- 第一个只出现一次的字符
- Python-Day3知识点——深浅拷贝、函数基本定义、内置函数