語言

AuthenticationHeaderValue 建構函式

定義

初始化 AuthenticationHeaderValue 類別的新執行個體。

多載

名稱 Description
AuthenticationHeaderValue(String)

初始化 AuthenticationHeaderValue 類別的新執行個體。

AuthenticationHeaderValue(String, String)

初始化 AuthenticationHeaderValue 類別的新執行個體。

AuthenticationHeaderValue(String)

來源:
AuthenticationHeaderValue.cs
來源:
AuthenticationHeaderValue.cs
來源:
AuthenticationHeaderValue.cs
來源:
AuthenticationHeaderValue.cs
來源:
AuthenticationHeaderValue.cs

初始化 AuthenticationHeaderValue 類別的新執行個體。

public:
 AuthenticationHeaderValue(System::String ^ scheme);
public AuthenticationHeaderValue(string scheme);
new System.Net.Http.Headers.AuthenticationHeaderValue : string -> System.Net.Http.Headers.AuthenticationHeaderValue
Public Sub New (scheme As String)

參數

scheme
String

要用於授權的配置。

備註

範例:

HttpClient client = new HttpClient();
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue(ACCESS_TOKEN);
Dim client = New HttpClient()
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue(ACCESS_TOKEN)

將產生以下標頭:

Authorization: ACCESS_TOKEN

適用於

AuthenticationHeaderValue(String, String)

來源:
AuthenticationHeaderValue.cs
來源:
AuthenticationHeaderValue.cs
來源:
AuthenticationHeaderValue.cs
來源:
AuthenticationHeaderValue.cs
來源:
AuthenticationHeaderValue.cs

初始化 AuthenticationHeaderValue 類別的新執行個體。

public:
 AuthenticationHeaderValue(System::String ^ scheme, System::String ^ parameter);
public AuthenticationHeaderValue(string scheme, string parameter);
public AuthenticationHeaderValue(string scheme, string? parameter);
new System.Net.Http.Headers.AuthenticationHeaderValue : string * string -> System.Net.Http.Headers.AuthenticationHeaderValue
Public Sub New (scheme As String, parameter As String)

參數

scheme
String

要用於授權的配置。

parameter
String

包含使用者代理對所請求資源認證資訊的憑證。

備註

範例:

HttpClient client = new HttpClient();
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", ACCESS_TOKEN);
Dim client = new HttpClient()
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", ACCESS_TOKEN)

將產生以下標頭:

Authorization: Bearer ACCESS_TOKEN

適用於