System.Net.HttpWebRequest.KeepAlive Property

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

Syntax

public bool KeepAlive { get; set; }

Value

true indicates that the current request will contain an HTTP Connection header with the value "Keep-alive" ; otherwise, false. The default value is true.

Remarks

Set this property to true to send a Connection HTTP header with the value Keep-alive. An application uses HttpWebRequest.KeepAlive to indicate a preference for persistent connections. When the HttpWebRequest.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 HttpWebRequest.KeepAlive to false may result in sending a Connection: Close header to the server.

Requirements

Namespace: System.Net
Assembly: System (in System.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0, 4.0.0.0