InternetErrorDlg Function
InternetErrorDlg Function

Displays a dialog box for the error that is passed to InternetErrorDlg, if an appropriate dialog box exists. If the FLAGS_ERROR_UI_FILTER_FOR_ERRORS flag is used, the function also checks the headers for any hidden errors and displays a dialog box if needed.

Syntax

DWORD InternetErrorDlg(
  __in     HWND hWnd,
  __inout  HINTERNET hRequest,
  __in     DWORD dwError,
  __in     DWORD dwFlags,
  __inout  LPVOID *lppvData
);


Parameters

hWnd [in]

Handle to the parent window for any needed dialog box. This parameter can be NULL if no dialog box is needed.

hRequest [in, out]

Handle to the Internet connection used in the call to HttpSendRequest.

dwError [in]

Error value for which to display a dialog box. This parameter can be one of the following values.

ValueMeaning
ERROR_INTERNET_CLIENT_AUTH_CERT_NEEDED

The server is requesting client authentication.

The return value for this error is always ERROR_SUCCESS, regardless of whether the user clicked the CANCEL button or selected a certificate. When the CANCEL button is clicked, there is no client certificate for the current request.

ERROR_INTERNET_HTTP_TO_HTTPS_ON_REDIR

Notifies the user of the zone crossing to and from a secure site.

ERROR_INTERNET_INCORRECT_PASSWORD

Displays a dialog box requesting the user's name and password.

ERROR_INTERNET_INVALID_CA

Notifies the user that the function does not recognize the certificate authority that generated the certificate for this Secure Sockets Layer (SSL) site.

ERROR_INTERNET_POST_IS_NON_SECURE

Displays a warning about posting data to the server through a nonsecure connection.

ERROR_INTERNET_SEC_CERT_CN_INVALID

Indicates that the SSL certificate Common Name (host name field) is incorrect. Displays an Invalid SSL Common Name dialog box and lets the user view the incorrect certificate. Also allows the user to select a certificate in response to a server request.

ERROR_INTERNET_SEC_CERT_DATE_INVALID

Tells the user that the SSL certificate has expired.

 

dwFlags [in]

Actions. This parameter can be one or more of the following values.

ValueMeaning
FLAGS_ERROR_UI_FILTER_FOR_ERRORS

Scans the returned headers for errors. Call InternetErrorDlg with this flag set following a call to HttpSendRequest so as to detect hidden errors. Authentication errors, for example, are normally hidden because the call to HttpSendRequest completes successfully, but by scanning the status codes, InternetErrorDlg can determine that the proxy or server requires authentication.

FLAGS_ERROR_UI_FLAGS_CHANGE_OPTIONS

If the function succeeds, stores the results of the dialog box in the Internet handle.

FLAGS_ERROR_UI_FLAGS_GENERATE_DATA

Queries the Internet handle for needed information. The function constructs the appropriate data structure for the error. (For example, for Cert CN failures, the function grabs the certificate.)

FLAGS_ERROR_UI_SERIALIZE_DIALOGS

Serializes authentication dialog boxes for concurrent requests on a password cache entry. The lppvData parameter should contain the address of a pointer to an INTERNET_AUTH_NOTIFY_DATA structure, and the client should implement a thread-safe, nonblocking callback function.

 

lppvData [in, out]

Pointer to the address of a data structure. The structure can be different for each error that needs to be handled.

Return Value

Returns one of the following values, or an error value otherwise.

Return codeDescription
ERROR_SUCCESS

The function completed successfully.

For more information, see ERROR_INTERNET_CLIENT_AUTH_CERT_NEEDED in the dwError parameter.

ERROR_CANCELLED

The function was canceled by the user.

ERROR_INTERNET_FORCE_RETRY

This indicates that the function needs to redo its request. In the case of authentication this indicates that the user clicked the OK button.

ERROR_INVALID_HANDLE

The handle to the parent window is invalid.

 

Remarks

Always inform the user when any of the following events occur:

  • ERROR_INTERNET_HTTP_TO_HTTPS_ON_REDIR
  • ERROR_INTERNET_INVALID_CA
  • ERROR_INTERNET_POST_IS_NON_SECURE
  • ERROR_INTERNET_SEC_CERT_CN_INVALID
  • ERROR_INTERNET_SEC_CERT_DATE_INVALID

Unless the user has explicitly chosen not to be informed of these events, failure to do so exposes the user involuntarily to a significant security risk.

Requirements

Minimum supported clientWindows 2000 Professional
Minimum supported serverWindows 2000 Server
VersionInternet Explorer 3.0 or later
HeaderWininet.h
LibraryWininet.lib
DLLWininet.dll

See Also

Enabling Internet Functionality
WinINet Functions

Send comments about this topic to Microsoft

Build date: 11/19/2009

© 2009 Microsoft Corporation. All rights reserved.   Terms of Use | Trademarks | Privacy Statement
Page view tracker
Rate the Lightweight library
x
Lightweight builds on ScriptFree (loband) by adding features you've requested: a SearchBox and default code language selection.
Do you like the SearchBox?
Do you like the tabbed code blocks?
How useful is this topic?
Tell us more.
Thanks
x
You're helping to improve MSDN Online.
Feedback
Switch View
Classic
Lightweight Beta
ScriptFree
Switch View