当前位置: 首页 > 图文教程 > 网络编程 > 编程10000问 > 如何处理超时事件?

编程10000问
如何计算下载一个文件需要多长时间?
如何检测用户第一次访问我的网站并显示友好信息?
如何判断URL格式是否符合规范?
如何取得服务器上的用户组列表?
如何显示数据库的结构?
如何显示最后十名来访者?
如何显示随机信息?
如何向前端推送用户请求的信息?
如何修改被表单引用的ASP页面?
如何验证IP地址?
如何用ASP建立Index Server查询对象并为其参数赋值?
如何用ASP输出HTML文件?
如何用表单的方式推送请求的信息?
如何远程读取数据库页面?
如何在ASP里显示进度条?
如何自动更新导航栏?
如何阻止别人非法链接你网站的图片?
怎样获知数据库的连接属性?
如何按时间显示最新标志
禁止站外提交表单(author:killer)

编程10000问 中的 如何处理超时事件?


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2010-01-10   浏览: 28 ::
收藏到网摘: n/a

如何处理超时事件?


1
IIS为一个死循的执行过程设定执行时间(缺省为90秒)超时事件:
<%response.buffer=true%>
<body><html>
<%
DO
counter=counter+1
response.write counter & "<br>"
response.flush
LOOP
%>
</body></html>

2、自定义时间。用程序设定超时事件的时间段:
<%
response.buffer=true
server.scripttimeout=20
%>
<body><html>
<%
DO
counter=counter+1
response.write counter & "<br>"
response.flush
LOOP
%>
</body></html>

3、干涉超时时间段。捕获超时:
<%@ trANSACTION=Required%>
<%
response.buffer=true
server.scripttimeout=20
%>
<html><body>
</body>
<%
DO
counter=counter+1
response.write counter & "<br>"
LOOP
response.flush
response.write "
脚本运行完啦!"
%>
</html>
<%
Sub OnTransactionAbort()
response.clear
Response.Write "
,脚本运行超时了!"
end sub
%>
4
、绕过超时事件:
<%@ trANSACTION=Required%>
<%
response.buffer=true
server.scripttimeout=40
%>
<html><body>
</body>
<%
DO UNTIL counter=400
counter=counter+1
response.write counter & "<br>"
LOOP
response.flush
response.write "
脚本运行完啦!"
%>
</html>
<%
Sub OnTransactionAbort()
response.clear
Response.Write "
,脚本运行超时了!"
end sub
%>