Retrieves the value of an HTTP header from the response body.
strValue = oServerXMLHTTPRequest.getResponseHeader(bstrHeader);
var xmlServerHttp = new ActiveXObject("Msxml2.ServerXMLHTTP.5.0"); xmlServerHttp.open("GET", "http://localhost/sample.xml", false); xmlServerHttp.send(); alert(xmlServerHttp.getResponseHeader("Content-Length"));
strValue = oServerXMLHTTPRequest.getResponseHeader(bstrHeader)
Dim xmlServerHttp As New Msxml2.ServerXMLHTTP50 xmlServerHttp.open "GET", "http://localhost/sample.xml", False xmlServerHttp.send MsgBox xmlServerHttp.getResponseHeader("Content-Length")
HRESULT getResponseHeader(BSTR bstrHeader, BSTR* pbstrValue);
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.
getAllResponseHeaders Method(ServerXMLHTTP/IServerXMLHTTPRequest) | send Method (ServerXMLHTTP/IServerXMLHTTPRequest) | setRequestHeader Method (ServerXMLHTTP/IServerXMLHTTPRequest)
Applies to: IServerXMLHTTPRequest/ServerXMLHTTP