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)

public bool KeepAlive { get; set; }

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.

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.

NoteNote

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.

Show: