Windows apps
Collapse the table of content
Expand the table of content
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

IXMLHTTPRequest2::GetResponseHeader method

Retrieves the value of an HTTP header from the response headers.

Syntax


HRESULT GetResponseHeader(
  [in]            const WCHAR *pwszHeader,
  [out, optional]       WCHAR **ppwszValue
);

Parameters

pwszHeader [in]

A case-insensitive header name.

ppwszValue [out, optional]

The resulting header information. You should free the memory for this parameter by calling the CoTaskMemFree function.

Return value

Returns S_OK on success.

Remarks

The results of this method are valid only after OnHeadersAvailable callback method has been called.

Examples


HRESULT hr = S_OK;
WCHAR *pwszHeaderValue = NULL;
IXMLHTTPRequest2 *pIXMLHTTPRequest2 = NULL;

// Create XMLHTTPRequest2 object and initialize pIXMLHTTP2Request.
hr = pIXMLHTTPRequest2->GetResponseHeader(L"Server", &pwszHeaderValue);
if(SUCCEEDED(hr))
{
   MessageBox(NULL, pwszHeaderValue, L"Response Header-Server", MB_OK);   
}   

if (pwszHeaderValue != NULL)
{
   CoTaskMemFree(pwszHeaderValue);
   pwszHeaderValue = NULL;
}

// Release pIXMLHTTPRequest2 when finished with it.


Requirements

Minimum supported client

Windows 8 [desktop apps | Windows Store apps]

Minimum supported server

Windows Server 2012 [desktop apps | Windows Store apps]

Minimum supported phone

Windows Phone 8.1 [Windows Phone Silverlight 8.1 and Windows Runtime apps]

Version

MSXML 6.0 and later

Header

Msxml6.h

IDL

Msxml6.idl

See also

OnHeadersAvailable
GetAllResponseHeaders
CoTaskMemFree
IXMLHTTPRequest2

 

 

Community Additions

Show:
© 2017 Microsoft