Value Property
Collapse the table of content
Expand the table of content
The document is archived and information here might be outdated

Value Property

Visual Studio .NET 2003

Gets or sets the value part of an HTTP header name-value pair.

strValue = Header.Value [ = strName ]

Return value

strValue As String. The value part of the HTTP header.


A Header object can represent a field from either a response header or a request header.


' Function to get a resource's size by sending a HEAD 
' request to the server and checking the value of the 
' Content-Length header field.
Function GetResourceSize(strServer, strPath)   
   Dim oConnection, oRequest, oResponse, oContentLengthHeader
   Dim strContentLength

   Set oConnection = Test.CreateConnection(strServer)
   ' check for connection errors
   If (oConnection Is Nothing) Then
      Test.Trace("Error: Unable to create connection.")
      Set oRequest = Test.CreateRequest
      oRequest.Path = strPath
      oRequest.Verb = "HEAD"
      Set oResponse = oConnection.Send(oRequest)
      If (oRequest Is Nothing) Then
         Call Test.Trace("Error: invalid request or host not found ")
         If (oResponse.ResultCode = "200") Then
            Set oContentLengthHeader = oResponse.Headers.Item("Content-Length")
            strContentLength = "Content-Length=" & oContentLengthHeader.Value
            strContentLength = "Error, status code: " & oResponse.ResultCode
         End If
      End If
      Call oConnection.Close()
   End If

   GetResourceSize = strContentLength
End Function

See Also

Header object | Headers.Item property | Header.Name

© 2016 Microsoft