Share via


KeepAlive Property

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

Gets or sets a value that indicates whether to make a persistent connection to the Internet resource.

Namespace:  System.Net
Assembly:  System.Http (in System.Http.dll)

Syntax

'Declaration
Public Property KeepAlive As Boolean
public bool KeepAlive { get; set; }
public:
property bool KeepAlive {
    bool get ();
    void set (bool value);
}
member KeepAlive : bool with get, set
function get KeepAlive () : boolean
function set KeepAlive (value : boolean)

Property Value

Type: System. . :: . .Boolean
true if the request to the Internet resource should contain a Connection HTTP header with the value Keep-alive; otherwise, false. The default is true.

Remarks

Set this property to true to send a Connection HTTP header with the value Keep-alive. An application uses KeepAlive to indicate a preference for persistent connections. When the KeepAlive property is true, the application makes persistent connections to the servers that support them.

Note

When using HTTP/1.1, Keep-Alive is on by default. Setting KeepAlive to false may result in sending a Connection: Close header to the server.

.NET Framework Security

See Also

Reference

HttpWebRequest Class

System.Net Namespace