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;
A NameValueCollection of headers.
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 = " "; %>
<tr>
<td><%= name %></td>
<td><%= val %></td></tr>
<% } %>
</table>
Show me
HttpRequest Members