System.Net.HttpWebRequest.KeepAlive Property

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


public bool KeepAlive { get; set; }


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


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.


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.


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