This documentation is archived and is not being maintained.

Headers Property

Visual Studio .NET 2003

Gets the Headers collection object for the HTTP request.

oHeaders = Request.Headers

Return value

oHeaders As Headers: A Headers collection object for the HTTP request.


Use the Headers.Item property to access objects representing the individual header fields, such as the User Agent.

See the topic describing the Test.CreateRequest method for information about the default headers and other properties of newly-created Request objects. For more information about using automatically generated header values, see Using Automatic Variables in Dynamic Tests.


' Procedure to display the properties of each 
' Header object in the Headers collection.
Sub ShowHeadersProperties(oMessage)
   Dim oHeader, oHeaders, lCount, strInfo

   Set oHeaders = oMessage.Headers

   strInfo = "-- Headers info --" & vbCrLf
   For Each oHeader In oHeaders
      strInfo = strInfo & oHeader.Name & ": " & oHeader.Value & vbCrLf

   Call Test.Trace(strInfo)
   Call Test.Trace("(Total: " & CStr(oHeaders.Count) & _ 
                  " header fields)")
End Sub

See Also

Request object| Response.Headers property | HTTP Header Fields Reference