3

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?

4

1 回答 1

5

您只需使用另一个HttpWebRequest对象,并假设您在这两种情况下都设置KeepAlivetrue.NET Framework 中的内部 HTTP 连接管理器应该为您处理事情。有关此属性的更多信息,请参阅MSDN 文档。KeepAlive

于 2009-04-14T20:34:14.407 回答