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
%>