Get HTTP Request Headers
using System;
using System.IO;
using System.Net;
public class TryHttpRequest {
public static void Main(String [] args) {
HttpWebRequest request =(HttpWebRequest)WebRequest.Create("http://www.navioo.com");
HttpWebResponse response =(HttpWebResponse)request.GetResponse();
request.Accept = "text/plain";
Console.WriteLine("Request header count: {0}",request.Headers.Count);
WebHeaderCollection header = request.Headers;
for (int i = 0; i < header.Count; i++)
Console.WriteLine(" {0} : {1}",header.GetKey(i), header[i]);
}
}
|
HTML code for linking to this page:
Related in same category :
-
-
|