IWinHttpRequest::SetAutoLogonPolicy method

The SetAutoLogonPolicy method sets the current Automatic Logon Policy.

Syntax

HRESULT SetAutoLogonPolicy(
  [in] WinHttpRequestAutoLogonPolicy AutoLogonPolicy
);

Parameters

AutoLogonPolicy [in]

Specifies the current automatic logon policy.

Return value

The return value is S_OK on success or an error value otherwise.

Remarks

The default policy is AutoLogonPolicy_OnlyIfBypassProxy.

Call SetAutoLogonPolicy to set the automatic logon policy before calling Send to send the request.

Note

For Windows XP and Windows 2000, see the Run-Time Requirements section of the WinHTTP Start Page.

Examples

The following scripting example shows how to set the automatic logon policy to never use NTLM or Negotiate authentication automatically.

// Instantiate a WinHttpRequest object.
var HttpReq = new ActiveXObject("WinHttp.WinHttpRequest.5.1");
    
// Open an HTTP connection.
HttpReq.Open("GET", "https://www.fabrikam.com/", false);
    
// Do not automatically send user credentials.
HttpReq.SetAutoLogonPolicy(2);

// Send the HTTP Request.
HttpReq.Send();

Requirements

Requirement Value
Minimum supported client
Windows XP, Windows 2000 Professional with SP3 [desktop apps only]
Minimum supported server
Windows Server 2003, Windows 2000 Server with SP3 [desktop apps only]
Redistributable
WinHTTP 5.0 and Internet Explorer 5.01 or later on Windows XP and Windows 2000.
IDL
HttpRequest.idl
Library
Winhttp.lib
DLL
Winhttp.dll

See also

IWinHttpRequest

WinHttpRequest

Authentication in WinHTTP

WinHTTP Versions