HttpWebRequest.Connection的问题

HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://localhost/");
request.Connection = "keep-alive";

Error:System.ArgumentException: Keep-Alive 和 Close 不能使用此属性设置。

应该怎样设置HttpWebRequest.Connection属性呢??

HttpWebRequest.KeepAlive = True;

本文来自博客园,作者:ganjiqi,转载请注明原文链接:https://www.cnblogs.com/ganjiqi/p/7685916.html

原文地址:https://www.cnblogs.com/ganjiqi/p/7685916.html