getAllResponseHeaders Method (IXMLHTTPRequest)

MSXML 5.0 SDK

Microsoft XML Core Services (MSXML) 5.0 for Microsoft Office - DOM Reference

getAllResponseHeaders Method (IXMLHTTPRequest)

Retrieves the values of all the HTTP headers.

[Script]

Script Syntax

strValue = oXMLHttpRequest.getAllResponseHeaders();

Return Value

A string. Contains the resulting header information.

Example

var xmlhttp = new ActiveXObject("Msxml2.XMLHTTP.5.0");
xmlhttp.open("GET", "http://localhost/sample.xml", false);
xmlhttp.send();
alert(xmlhttp.getAllResponseHeaders());
[Visual Basic]

Visual Basic Syntax

strValue = oXMLHttpRequest.getAllResponseHeaders

Return Value

A string. Contains the resulting header information.

Example

Dim xmlhttp As New Msxml2.xmlhttp
xmlhttp.open "GET", "http://localhost/sample.xml", False
xmlhttp.send
MsgBox xmlhttp.getAllResponseHeaders()
[C/C++]

C/C++ Syntax

HRESULT getAllResponseHeaders(BSTR *pbstrHeaders);

Parameters

pbstrHeaders [out, retval]
The resulting header information.

C/C++ Return Values

S_OK
The value returned if successful.

C/C++ Example

HRESULT hr;
BSTR bstrValue = NULL;
IXMLHttpRequest *pIXMLHttpRequest = NULL;

try
{
   // Create XMLHttpRequest object and initialize pIXMLHttpRequest.
   hr = pIXMLHttpRequest->getAllResponseHeaders(&bstrValue);
   if(SUCCEEDED(hr))
      ::MessageBox(NULL, bstrValue, _T("All Response Headers"), MB_OK);
}
catch(...)
{
   DisplayErrorToUser();
}
// Release pIXMLHttpRequest when finished with it.

Remarks

Each header name/value pair is separated by a combination carriage return-line feed character (vbCrLf in Microsoft® Visual Basic®).

The results of this method are valid only after the send method has been successfully completed.

To view reference information for Visual Basic, C/C++, or Script only, click the Language Filter button Language Filter in the upper-left corner of the page.

See Also

send Method (IXMLHTTPRequest) | getResponseHeader Method (IXMLHTTPRequest) | setRequestHeader Method (IXMLHTTPRequest)

Applies to: IXMLHTTPRequest