|
Do Loop Intercept Timeouts
by Charles Carroll
The transactional nature of ASP pages can be used
to intercept a script timeout.
loop3.asp traps a timeout:
filename=/learn/test/loop3.asp
<%@ TRANSACTION=Required%>
<%
response.buffer=true
server.scripttimeout=10
%>
<HTML>
<TITLE>loop3.asp</TITLE>
<body bgcolor="#FFFFFF">
<head><meta name="Robots" content="Noindex,Nofollow" /></head>
</BODY>
<%
DO UNTIL COUNTER = 111111
counter=counter+1
response.write counter & "<br>"
iFlush = iflush + 1
if iflush = 25 then
iflush = 0
Response.Flush
end if
LOOP
'response.flush
response.write "Script executed without incident"
%>
</HTML>
<%
Sub OnTransactionAbort()
response.clear
Response.Write "The Script Timed Out"
end sub
%>
loop4.asp succeeds and does not trigger the trap:
filename=/learn/test/loop4.asp
<%@ TRANSACTION=Required%>
<%
response.buffer=true
server.scripttimeout=40
%>
<HTML>
<TITLE>loop4.asp</TITLE>
<body bgcolor="#FFFFFF">
</BODY>
<%
DO UNTIL counter=400
counter=counter+1
response.write counter & "<br>"
LOOP
response.flush
response.write "Script Exexuted without incident!"
%>
</HTML>
<%
Sub OnTransactionAbort()
response.clear
Response.Write "The Script Timed Out"
end sub
%>
 |  |  |
 |
There are many worthy charities!!. But perhaps help starving children in Africa or South America AND help Charles too.
a $5 tip buys him lunch at McDonalds,
a $20 tip buys his kid Hitoshi a new computer game,
a $39 tip buys his daughter Michiko a few nice outfits.
See our donor list.
|  |
 |  |  |
|
|
|
|