
Output | 365
HttpResponse
Class
This is the Title of the Book, eMatter Edition
Copyright © 2008 O’Reilly & Associates, Inc. All rights reserved.
Parameter
Boolean
A Boolean variable to receive the value of the property.
Example
The example checks the IsClientConnected property before starting a long-running
processing task in order to avoid the expense of running the task if the client is no
longer connected. If the property returns
False, the code calls the Response.End
method. Even though the client has disconnected and can no longer receive the
buffered output (which is sent when the End method is called), calling the End
method is still a good idea, since it will halt further processing of the page and fire
the Application_EndRequest event. If you have written cleanup code for the page
that is run by the event handler for Application_EndRequest, calling Response.End
will ensure that the cleanup code is executed, even if the client disconnects.
Sub Page_Load( )
'Check client connection status
If Response.IsClientConnected = False Then
Response.End
Else
'Start long-running processing task
End If
End Sub
Notes
The IsClientConnected property is especially useful for long-running processes
that require a significant amount of processing resources on the server. By
querying the IsClientConnected property before starting an expensive processing
task, or by querying the property periodically during processing, ...