Reads page headers into dictionary object. an example of using Dictionary in ASP Classic.
GetHeaders returns all headers sent to the current web page by a given user's browser.
GetHeaders returns a reference to a Scripting.Dictionary object. The Keys and Items collections will be filled with all header name, value combinations sent by the browser.
Function GetHeaders()
Dim item, Di, sKey, sItem
' Set Di = Server.CreateObject("Scripting.Dictionary")
Set Di = CreateObject("Scripting.Dictionary")
Di.RemoveAll
For Each Item In Request.ServerVariables
If Left(UCase(Item), 5) = "HTTP_" Then
sKey = Replace(Right(Ucase(Item), Len(Item) - 5), "_", "-")
sItem = Request.ServerVariables(Item)
If Not Di.Exists(sKey) Then Di.Add sKey, sItem
End If
Next
Set GetHeaders = Di
End Function
Dim item, Di, sKey, sItem
' Set Di = Server.CreateObject("Scripting.Dictionary")
Set Di = CreateObject("Scripting.Dictionary")
Di.RemoveAll
For Each Item In Request.ServerVariables
If Left(UCase(Item), 5) = "HTTP_" Then
sKey = Replace(Right(Ucase(Item), Len(Item) - 5), "_", "-")
sItem = Request.ServerVariables(Item)
If Not Di.Exists(sKey) Then Di.Add sKey, sItem
End If
Next
Set GetHeaders = Di
End Function
Views 126
Downloads 37
CodeID
DB ID
ANmarAmdeen
610
Revisions
v1.0
Thursday
May
5
2022