The information in this article applies to:
SUMMARYThis article explains how to select a client certificate using the WinInet APIs. MORE INFORMATIONWhen accessing any SSL protected resource on a Web server that requires a valid client certificate, the WinInet HttpSendRequest API or MFC CInternetFile::SendRequest will fail initially with the following error: To correctly handle this error, you can call InternetErrorDlg to bring up the client certificate dialog box (similar to the one in Internet Explorer) for the user to select the certificate. The code sample is shown as follows:
The same idea applies to MFC WinInet. In the case of MFC WinInet classes, the MFC methods corresponding to the WinInet APIs above are as follows:
Notes
If Cancel is clicked, then certificate won't be sent. If OK is clicked, the certificate will be sent. If the client certificate is not sent but server requires it, error HTTP status code will be returned. The status code will be 403. You can get it like this:
Receiving 403 on the second retry of HttpSendRequest after InternetErrorDlg was called can indicate that user clicked Cancel.
REFERENCESFor information on how to handle invalid server certificate authority error with WinInet, please see the following article in the Microsoft Knowledge Base: Q182888 Handle Invalid Certificate Authority Error with WinInet Additional query words:
Keywords : kbIE400 kbIE401 kbIE401sp1 kbIE401sp2 kbIE500 |
Last Reviewed: May 20, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |