HttpClientHandler.PreAuthenticate 属性

定义

获取或设置一个值,该值指示处理程序是否随请求发送授权标头。Gets or sets a value that indicates whether the handler sends an Authorization header with the request.

public:
 property bool PreAuthenticate { bool get(); void set(bool value); };
public bool PreAuthenticate { get; set; }
[System.Runtime.Versioning.UnsupportedOSPlatform("browser")]
public bool PreAuthenticate { get; set; }
member this.PreAuthenticate : bool with get, set
[<System.Runtime.Versioning.UnsupportedOSPlatform("browser")>]
member this.PreAuthenticate : bool with get, set
Public Property PreAuthenticate As Boolean

属性值

Boolean

true 表示处理程序在发生身份验证之后随请求一起发送 HTTP 授权标头;否则为 falsetrue for the handler to send an HTTP Authorization header with requests after authentication has taken place; otherwise, false. 默认值为 falseThe default is false.

属性

注解

对特定的客户端请求 Uri 成功通过身份验证后,如果 PreAuthenticate 属性为 true 并提供凭据,则将 HttpClientHandler 与属性中提供的凭据列表匹配 CredentialsAfter 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. 授权标头随每个请求一起发送到任何 Uri 匹配 Uri 上一个正斜杠的特定的。The Authorization header is sent with each request to any Uri that matches the specific Uri up to the last forward slash.

如果未成功对特定的客户端请求 Uri 进行身份验证,则该请求将使用标准身份验证过程。If the client request to a specific Uri is not successfully authenticated, the request uses standard authentication procedures.

除了第一个请求之外, PreAuthenticate 属性指示是否将身份验证信息与后续请求一起发送到 Uri ,该请求与最后一个 Uri 正斜杠匹配,而不等待服务器质询。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.

适用于