Request a second url with the same HttpWebRequest obj

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 to keep a connection alive and navigate to multiple URLs using the same live connection?

+3
source share
1 answer

You just use a different object, HttpWebRequestand provided that you install KeepAlivein true, in both cases, the internal HTTP connection manager in the .NET Framework should handle things for you. For more information, see the MSDN documentation for the property KeepAlive.

+5
source

Source: https://habr.com/ru/post/1706419/


All Articles