<%@ Page Language="vb" %>
Showing HTTP Headers via the Headers Collection in ASP.NET
<%
Dim AllHttp As String
AllHttp = Request.ServerVariables("ALL_HTTP")
AllHttp = Replace(AllHttp, "HTTP", "
HTTP")
Response.Write(AllHttp & "
")
Dim Counter1, Counter2 As Integer
Dim Keys(), subKeys() As String
Dim HeaderColl As NameValueCollection
HeaderColl=Request.Headers
Keys = HeaderColl.AllKeys
For Counter1 = 0 To Keys.GetUpperBound(0)
Response.Write("Key: " & Keys(Counter1) & "
")
subKeys = HeaderColl.GetValues(Counter1) ' Get all values under this key.
For Counter2 = 0 To subKeys.GetUpperBound(0)
Response.Write("Value " & CStr(Counter2) & ": " & subKeys(Counter2) & "
")
Next Counter2
Next Counter1
%>