Created
December 14, 2022 16:56
-
-
Save AaronSadlerUK/f18857092a38ed55914532f9a46f7691 to your computer and use it in GitHub Desktop.
Output Headers
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%@ Page Language="vb" %> | |
<html> | |
<head> | |
<title>Showing HTTP Headers via the Headers Collection in ASP.NET</title> | |
</head> | |
<body> | |
<% | |
Dim AllHttp As String | |
AllHttp = Request.ServerVariables("ALL_HTTP") | |
AllHttp = Replace(AllHttp, "HTTP", "<br>HTTP") | |
Response.Write(AllHttp & "<br>") | |
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) & "<br>") | |
subKeys = HeaderColl.GetValues(Counter1) ' Get all values under this key. | |
For Counter2 = 0 To subKeys.GetUpperBound(0) | |
Response.Write("Value " & CStr(Counter2) & ": " & subKeys(Counter2) & "<br>") | |
Next Counter2 | |
Next Counter1 | |
%> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment