getAllResponseHeaders Method (IXMLHTTPRequest)
Retrieves the values of all the HTTP headers.
strValue = oXMLHttpRequest.getAllResponseHeaders();
Return Value
A string. Contains the resulting header information.
Example
var xmlhttp = new ActiveXObject("Msxml2.XMLHTTP.6.0"); xmlhttp.open("GET", "http://localhost/sample.xml", false); xmlhttp.send(); WScript.Echo(xmlhttp.getAllResponseHeaders());
Output
This example returns the resulting page header information that was returned by the Web (HTTP) server hosting the specified page (sample.xml). For example, your output should include the following type header field information:
Server:Microsoft-IIS/5.1 X-Powered-By:ASP.NET Date:Sat, 07 Jun 2003 23:23:06 GMT Content-Type:text/xml Accept-Ranges:bytes Last Modified:Sat, 06 Jun 2003 17:19:04 GMT ETag:"a0e2eeba4f2cc31:97f" Content-Length:9
HRESULT getAllResponseHeaders(BSTR *pbstrHeaders);
Parameters
pbstrHeaders[out, retval]
The resulting header information.
Return Values
S_OK
The value returned if successful.
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.
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.
Implemented in: MSXML 3.0 and MSXML 6.0
send Method (IXMLHTTPRequest)
getResponseHeader Method (IXMLHTTPRequest)
setRequestHeader Method (IXMLHTTPRequest)