GetHeader Method  
 

Description of the method.

Syntax

object.GetHeader( HeaderName, HeaderValue )

Parameters

HeaderName
A string which specifies the header name.
HeaderValue
A string buffer which will contain the value of header associated with the header name when the method returns.

Return Value

Returns True if the method succeeds or False if the method fails.

Remarks

The GetHeader method retrieves the value of a specific HTTP response header returned by the server. Header names are matched in a case-insensitive manner, with leading and trailing whitespace automatically trimmed before comparison. If multiple values are present for the specified header name, the behavior depends on the type of header:

  • For headers that must not be combined (such as Set-Cookie and Proxy-Authenticate), only the first value encountered is returned.
  • For all other headers, multiple values are joined together and returned as a single comma-separated string, as defined by the HTTP specification.

For headers such as Set-Cookie, which may legitimately occur multiple times with distinct values, GetHeader will only return the first occurrence. If your application needs to process each value individually, you should use GetFirstHeader and GetNextHeader to enumerate all response headers rather than relying on this method.

Response headers are only available after navigation has completed. Calling this method while a navigation is still in progress, or when displaying local file or data content, will fail.

See Also

ClearHeaders Method, GetFirstHeader Method, GetNextHeader Method