Article ID: 182888
Article Last Modified on 7/1/2004
...
Again:
if (!HttpSendRequest (hReq,...))
dwError = GetLastError ();
if (dwError == ERROR_INTERNET_INVALID_CA)
{
// Make sure to check return code from InternetErrorDlg
// user may click either OK or Cancel. In case of Cancel
// request should not be resumbitted.
InternetErrorDlg (GetDesktopWindow(),
hReq,
ERROR_INTERNET_INVALID_CA,
FLAGS_ERROR_UI_FILTER_FOR_ERRORS |
FLAGS_ERROR_UI_FLAGS_GENERATE_DATA |
FLAGS_ERROR_UI_FLAGS_CHANGE_OPTIONS,
NULL);
goto again;
}
...
Method 2. Without a UI:
...
Again:
if (!HttpSendRequest (hReq,...))
dwError = GetLastError ();
if (dwError == ERROR_INTERNET_INVALID_CA)
{
DWORD dwFlags;
DWORD dwBuffLen = sizeof(dwFlags);
InternetQueryOption (hReq, INTERNET_OPTION_SECURITY_FLAGS,
(LPVOID)&dwFlags, &dwBuffLen);
dwFlags |= SECURITY_FLAG_IGNORE_UNKNOWN_CA;
InternetSetOption (hReq, INTERNET_OPTION_SECURITY_FLAGS,
&dwFlags, sizeof (dwFlags) );
goto again;
}
...
Similar logic can be used with MFC WinInet classes. In this case, the
following MFC methods correspond to the WinInet APIs used above:
ERROR_SUCCESS ERROR_CANCELLED ERROR_INTERNET_FORCE_RETRY.The request should be resubmitted only when ERROR_INTERNET_FORCE_RETRY is returned. In Internet Explorer 4.0 and 4.01, however, the request must be resubmitted even when ERROR_SUCCESS is returned.
168151 How to Make SSL Requests Using WinInet
Additional query words: kbdsi
Keywords: kberrmsg KB182888