STDMETHODIMP CMyTest::TestASPComp(void)
{
//declare a IRequestDictionary interface pointer
CComPtr<IRequestDictionary> pDict = NULL;
HRESULT hr = S_OK;
_bstr_t str;
try
{
//use the get_Form method of the Reqeust object to access the Form collection
hr = m_piRequest->get_Form(&pDict);
if (FAILED(hr))
return hr;
//get the specified field value
hr = GetDictItemValue(pDict, L"Name", str);
if (FAILED(hr))
_com_issue_errorex(hr, pDict, __uuidof(IRequestDictionary));
//write out the field name and its value
m_piResponse->Write(_variant_t(L"Name="));
m_piResponse->Write(_variant_t(str));
//ditto
hr = GetDictItemValue(pDict, L"Message", str);
if (FAILED(hr))
_com_issue_errorex(hr, pDict, __uuidof(IRequestDictionary));
m_piResponse->Write(_variant_t(L"<br>\nMessage="));
m_piResponse->Write(_variant_t(str));
}
catch (_com_error e)
{
return e.Error();
}
return S_OK;
}