Response Headers

In this chapter you will learn:

  1. How to print out the Response Headers

Response Headers

using System;//jav  a2 s  .c o  m
using System.Collections.Specialized;
using System.Net;

class MainClass
{
   public static void Main(string[] argv)
   {
      WebClient wc = new WebClient();

      byte[] response = wc.DownloadData("http://www.jva2s.com");
      WebHeaderCollection whc = wc.ResponseHeaders;
      Console.WriteLine("header count = {0}", whc.Count);
      for (int i = 0; i < whc.Count; i++)
      {
         Console.WriteLine(whc.GetKey(i) + " = " + whc.Get(i));
      }
   }
}

Next chapter...

What you will learn in the next chapter:

  1. Create WebProxy and use it in WebClient
Home » C# Tutorial » Network
Cookie
CredentialCache
HostEntry
IPHostEntry
IP address from host name
IPEndPoint from IPAddress
IPEndPoint Port
IPEndPoint properties
IPHostEntry
IP Address Parser
Predefined IP Address
NetworkCredential
Ping
Udp Client
Socket connection
Socket creation
Socket sendTo
TcpClient
TcpListener
UdpClient Receive
UdpClient Sending
Uri
WebClient
Response Headers
WebProxy
WebRequest