<% If Request("DontFrame")<>1 Then Response.Redirect "/iissamples/sdk/asp/docs/SampFram.asp?ovfile=/iishelp/iis/htm/sdk/samp3f72.asp&srcfile=Interaction/Cancel" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
If your Web-based application performs complicated or time-consuming calculations or procedures, it is often useful for it to periodically check-in with the client browser and confirm that they are, indeed, still connected to the server. For instance, an on-line catalog application could check the client browser's connection before and after performing each computationally-intensive operation, such as creating an individual catalog item page from a database, or generating a purchasing invoice. If at any time it discovers that the connection has been abandoned, the application can destroy the session and state information, and devote the server's resources to other tasks.</p>
<p>
This sample simulates an application that performs time-consuming calculations. A message is sent to the client browser that the application is about to perform a time-consuming operation, which in this case is simply a large loop. After the operation, the script checks the <b>Response.IsClientConnected</b> property to determine whether the client browser is still connected. If they are still connected, another time-consuming loop is performed, followed by another <b>Response.IsClientConnected</b> check. If the client browser remains connected, the user is rewarded with a thank you message.</p>