Rajveer singh

Rajveer singh

  • 802
  • 1k
  • 251.1k

what KeepAlive property with Httpversion 11 true or false?

Apr 25 2017 12:37 AM
Dear all,
                 I'm using Httpwebrequset method and ProtocolVersion 11 after thar error raised
'The underlying connection was closed: A connection that was expected to be kept alive was close by server '            how to resolved this issue
 
code here
HttpWebRequest req = (HttpWebRequest)(HttpWebRequest.Create(url));
req.Method = "POST";
req.ProtocolVersion = HttpVersion.Version11;
req.ContentType = "application/xml";
req.KeepAlive = false;req.Headers.Set(HttpRequestHeader.Authorization, "Basic   jhfgshfghj==");
// d1 = DateTime.Now;
XmlDocument XDAuth = new XmlDocument();
XmlNode docNode = XDAuth.CreateXmlDeclaration("1.0", "UTF-8", "yes");
XDAuth.AppendChild(docNode);
XmlNode Root = XDAuth.AppendChild(XDAuth.CreateElement("xml"));
 

Answers (11)