Senator Guerra Souty original series calendar,replica hublot blue steel peach pointer collocation of rolex replica Rome digital scale, track type minute replica watches scale shows that the classical model is swiss replica watches incomparable, wearing elegant dress highlights.
mr-ponna.com

 

YOU ARE HERE: HOME Questions Provide me some information regarding HTTP headers



About HTTP Headers

View(s): 5555

Provide me some information regarding HTTP headers

Answer 1)

HTTP headers expose a great deal of information about your client as well as the server.

 

In the Hypertext Transfer Protocol (HTTP), HTTP header fields contain the operating parameters of an HTTP request or response. With the request or response line (first line of message), they form the message header.

 

The header fields define various characteristics of the data transfer that is requested or the data that is provided in the message body. Header fields start with the field name, terminated with a colon character, followed by the field value.

 

Request Headers (headers sent by browser to server)

Generally the request headers will be sent by browser to server. And it contains information regarding type of browser, user language preferences (like English, German or Spanish), browser capabilities (like weather it can understand html or only text and type of compressions supported by requesting browser) and cookies (if any sent by server).


Here are sample headers how it looks like in a HTTP request.

Request Headers

Host

mr-ponna.com

User-Agent

Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.4) Gecko/20100611 Firefox/3.6.4

Accept

text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8,text/vnd.wap.wml;q=0.6

Accept-Language

en-us,en;q=0.5

Accept-Encoding

gzip,deflate

Accept-Charset

ISO-8859-1,utf-8;q=0.7,*;q=0.7

Keep-Alive

115

Connection

keep-alive

Cookie

mr-ponna-state=c4t1tfw1c4k5ooerpld5105z;


Response Headers (headers sent by server to browser)

Response headers will be sent by server to browser. And it contains information such as type of web server, response time, incoming content-type (weather response is text, html or image), cache information (weather browser can cache the response or not), cookies and status code (like File not found and Internal server error).

 

Here are sample headers how it looks like in a HTTP response.

Response Headers

Cache-Control

private

Content-Length

40209

Content-Type

text/html; charset=utf-8

Server

Microsoft-IIS/7.5

X-AspNet-Version  

4.0.30319

X-Powered-By

ASP.NET

Date

Tue, 24 Aug 2010 12:27:37 GMT

 

Keep in mind these HTTP headers not meant for ASP.NET, it’s for all web applications irrespective of technology.


In ASP.NET, you will deal with following 2 objects to read/send HTTP headers.

 

Request.Headers (to read all incoming headers)

Response.Headers (to send/modify response headers)

 

Here is sample code snippet to read all request headers:

foreach (string key in Request.Headers.AllKeys)

{

    Response.Write(string.Format("Header field name: {0} -> Value: {1}<br/>", key, Request.Headers[key]));

}

 

Here is sample code snippet for controlling client caching using response headers:

Response.Headers.Add("Pragma", "no-cache");

 

For more information regarding HTTP headers see:

Quick reference to HTTP headers

HTTP Header Field

 

  Asked in:  SemanticSpace Technologies   Expertise Level:  Intermediate
  Last updated on Friday, 08 April 2011
3/5 stars (3 vote(s))

Register Login Ask Us Write to Us Help