Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
A version of this page is also available for
4/8/2010

This method supplies authentication support to a URL moniker from a client application.

Syntax

HRESULT Authenticate(
  HWND* 
phwnd,
  LPWSTR* 
pszUsername,
  LPWSTR* 
pszPassword
);

Parameters

phwnd

[out] Address of a client-provided HWND of the parent window for a default user interface. To prevent a user interface from displaying, the client must provide a user name and password in the other parameters and this handle must be set to zero.

pszUsername

[out] Address of a string value that contains the user name to use for authentication. If the client returns a value in this parameter, the client should also set phwndto zero.

pszPassword

[out] Address of a string value that contains the password to use for authentication. If the client returns a value in this parameter, the client should also set phwndto zero.

Return Value

This method returns one of the values shown in the following table.

Value Description

S_OK

Authentication was successful.

E_ACCESSDENIED

Authentication failed.

E_INVALIDARG

One or more parameters are invalid.

Remarks

Applications that implement the IAuthenticate::Authenticatemethod must allocate the memory of the pszUsernameand pszPasswordbuffers using CoTaskMemAlloc. Applications that call the IAuthenticate::Authenticatemethod are responsible for freeing the memory with CoTaskMemFree.

The default user interface can handle any authentication schemes recognized by the Microsoft Win32 Internet function. Currently, the user name and password options handle only the Basic authentication scheme.

This method is related to the InternetErrorDlg.

Requirements

Header urlmon.h, urlmon.idl
Library urlmon.lib
Windows Embedded CE Windows CE .NET 4.0 and later
Windows Mobile Windows Mobile Version 5.0 and later