This documentation is archived and is not being maintained.

HttpResponse.IsClientConnected Property

Gets a value indicating whether the client is still connected to the server.

Namespace:  System.Web
Assembly:  System.Web (in System.Web.dll)

'Declaration
Public ReadOnly Property IsClientConnected As Boolean
'Usage
Dim instance As HttpResponse 
Dim value As Boolean 

value = instance.IsClientConnected

Property Value

Type: System.Boolean
true if the client is currently connected; otherwise, false.

The IsClientConnected property returns false when the following conditions are true:

The following example uses the IsClientConnected property to check whether the client that is requesting the page remains connected to the server. If IsClientConnected is true, the code calls the Redirect method, and the client will view another page. If IsClientConnected is false, then the code calls the End method and all page processing is terminated.

<%@ Page Language="VB" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
    Private Sub Page_Load(sender As Object, e As EventArgs)

        ' Check whether the browser remains 
        ' connected to the server. 
        If (Response.IsClientConnected) Then 

            ' If still connected, redirect 
            ' to another page.             
            Response.Redirect("Page2VB.aspx", false)
        Else 
            ' If the browser is not connected 
            ' stop all response processing.
            Response.End()
        End If 
    End Sub
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
    <title>ASP.NET Example</title>
</head>
<body>
    <form id="form1" runat="server">
    </form>
</body>
</html>

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0, 2.0, 1.1, 1.0
Show: