getResponseHeader Method (ServerXMLHTTP/IServerXMLHTTPRequest)
Retrieves the value of an HTTP header from the response body.
Script Syntax
strValue = oServerXMLHTTPRequest.getResponseHeader(bstrHeader);
Parameters
- bstrHeader
- A case-insensitive header name.
Example
var xmlServerHttp = new ActiveXObject("Msxml2.ServerXMLHTTP.5.0"); xmlServerHttp.open("GET", "http://localhost/sample.xml", false); xmlServerHttp.send(); alert(xmlServerHttp.getResponseHeader("Content-Length"));
Visual Basic Syntax
strValue = oServerXMLHTTPRequest.getResponseHeader(bstrHeader)
Parameters
- bstrHeader
- A case-insensitive header name.
Example
Dim xmlServerHttp As New Msxml2.ServerXMLHTTP50 xmlServerHttp.open "GET", "http://localhost/sample.xml", False xmlServerHttp.send MsgBox xmlServerHttp.getResponseHeader("Content-Length")
C/C++ Syntax
HRESULT getResponseHeader(BSTR bstrHeader, BSTR* pbstrValue);
Parameters
- bstrHeader [in]
- A case-insensitive header name.
- pbstrValue [out, retval]
- The resulting header information.
C/C++ Return Values
- S_OK
- The value returned if successful.
Remarks
The results of this method are valid only after the send
method has been successfully completed. The line, oServerXMLHTTPRequest.getResponseHeader("Content-Type");
returns the string "text/xml"
, assuming the server set "text/xml"
as the content type.
The full list of header variables you can query can be accessed from the getAllResponseHeaders
method.
To view reference information for Visual Basic, C/C++, or Script only, click the Language Filter button in the upper-left corner of the page.
See Also
getAllResponseHeaders Method(ServerXMLHTTP/IServerXMLHTTPRequest) | send Method (ServerXMLHTTP/IServerXMLHTTPRequest) | setRequestHeader Method (ServerXMLHTTP/IServerXMLHTTPRequest)
Applies to: IServerXMLHTTPRequest/ServerXMLHTTP