asp.net.ph

Request.Headers Property

System.Web Namespace   HttpRequest Class


Gets a collection of HTTP headers.

[ VB ]
Public ReadOnly Property Headers As NameValueCollection

[ C# ]
public NameValueCollection Headers {get;}

[ C++ ]
public: __property NameValueCollection* get_Headers ( );

[ JScript ]
public function get Headers ( ) : NameValueCollection;

Property Value

A NameValueCollection of headers.

Example

The following example [ C# ] shows how you can dynamically retrieve ( and display into an HTML table ) the names and values of all headers in the HTTP request.

<table class="data" width="90%">
<tr>
  <th>Header Name</th>
  <th>Value</th></tr>

<% string val;
  foreach ( string name in Request.Headers ) {
     If ( Request.Headers[ name ] != "" ) val = Request.Headers[ name ];
     else val = "&nbsp;"; %>
<tr>
  <td><%= name %></td>
  <td><%= val %></td></tr>
<% } %>
</table>

 Show me 

See Also

HttpRequest Members Skip Navigation Links




Home
Suggested Reading


Previous page Back to top Next page

© 2000-2010 Rey Nuñez All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note

You can help support asp.net.ph