Reputation:
I want to do something like this
{
HttpWebRequest WebRequestObject = (HttpWebRequest)HttpWebRequest.Create("http://google.com");
WebRequestObject.KeepAlive = true;
//do stuff
WebRequestObject.Something("http://www.google.com/intl/en_ALL/images/logo.gif");
//more here
}
How do i keep the connection alive and go to multiple urls using that same alive connection?
Upvotes: 3
Views: 4268
Reputation: 147360
You simply use another HttpWebRequest
object and provided that you set KeepAlive
to true
in both cases the internal HTTP connection manager in the .NET Framework should handle things for you. See the MSDN documentation for the KeepAlive
property for more info on this.
Upvotes: 5