1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
|
CComPtr<IBrowserCaps> m_spBrowserCaps;
[ tag_name(name = "LoadBrowserCaps") ]
HTTP_CODE OnLoadBrowserCaps()
{
// Get the IBrowserCapsSvc service from the ISAPI extension.
CComPtr<IBrowserCapsSvc> spBrowserCapsSvc;
if (FAILED(m_spServiceProvider->QueryService(
__uuidof(IBrowserCapsSvc), &spBrowserCapsSvc)))
{
return HTTP_FAIL;
}
// Get user agent string from the query parameters.
LPCSTR szUserAgent = m_HttpRequest.QueryParams.Lookup("UserAgent");
if (szUserAgent != NULL)
{
// Get the browser capabilities for the specified user agent.
if (FAILED(spBrowserCapsSvc->GetCapsUserAgent(
CComBSTR(szUserAgent), &m_spBrowserCaps)))
{
return HTTP_FAIL;
}
}
else
{
// Get the browser capabilities for the user's current user agent.
if (FAILED(spBrowserCapsSvc->GetCaps(m_spServerContext,
&m_spBrowserCaps)))
{
return HTTP_FAIL;
}
}
return HTTP_SUCCESS;
} |