Export (0) Print
Expand All

HttpClientHandler.PreAuthenticate Property

.NET Framework 4.5

Gets or sets a value that indicates whether the handler sends an Authorization header with the request.

Namespace:  System.Net.Http
Assembly:  System.Net.Http (in System.Net.Http.dll)

public bool PreAuthenticate { get; set; }

Property Value

Type: System.Boolean
Returns Boolean.
true for the handler to send an HTTP Authorization header with requests after authentication has taken place; otherwise, false. The default is false.

After a client request to a specific Uri is successfully authenticated, if the PreAuthenticate property is true and credentials are supplied, HttpClientHandler matches against the credential list supplied in the Credentials property. The Authorization header is sent with each request to any Uri that matches the specific Uri up to the last forward slash.

If the client request to a specific Uri is not successfully authenticated, the request uses standard authentication procedures.

With the exception of the first request, the PreAuthenticate property indicates whether to send authentication information with subsequent requests to a Uri that matches the specific Uri up to the last forward slash without waiting to be challenged by the server.

.NET Framework

Supported in: 4.6, 4.5

.NET for Windows Store apps

Supported in: Windows 8

Supported in: Windows Phone 8.1

Windows Phone 8.1, Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

© 2014 Microsoft