Gets or sets the value of the Connection HTTP header.
using System.Net;
using System;
using System.IO;
class MainClass
{
static void Main()
{
HttpWebRequest myHttpWebRequest1 = (HttpWebRequest)WebRequest.Create("http://www.google.com");
myHttpWebRequest1.KeepAlive = false;
HttpWebResponse myHttpWebResponse1 = (HttpWebResponse)myHttpWebRequest1.GetResponse();
Console.WriteLine(myHttpWebRequest1.Headers);
Stream streamResponse = myHttpWebResponse1.GetResponseStream();
StreamReader streamRead = new StreamReader(streamResponse);
Char[] readBuff = new Char[256];
int count = streamRead.Read(readBuff, 0, 256);
while (count > 0)
{
String outputData = new String(readBuff, 0, count);
Console.Write(outputData);
count = streamRead.Read(readBuff, 0, 256);
}
streamResponse.Close();
streamRead.Close();
}
}
Related examples in the same category