Share via


AuthenticationHeaderValue Costruttori

Definizione

Inizializza una nuova istanza della classe AuthenticationHeaderValue.

Overload

AuthenticationHeaderValue(String)

Inizializza una nuova istanza della classe AuthenticationHeaderValue.

AuthenticationHeaderValue(String, String)

Inizializza una nuova istanza della classe AuthenticationHeaderValue.

AuthenticationHeaderValue(String)

Origine:
AuthenticationHeaderValue.cs
Origine:
AuthenticationHeaderValue.cs
Origine:
AuthenticationHeaderValue.cs

Inizializza una nuova istanza della classe 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)

Parametri

scheme
String

Schema da usare per l'autorizzazione.

Commenti

Esempio:

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

Produrrà l'intestazione seguente:

Authorization: ACCESS_TOKEN

Si applica a

AuthenticationHeaderValue(String, String)

Origine:
AuthenticationHeaderValue.cs
Origine:
AuthenticationHeaderValue.cs
Origine:
AuthenticationHeaderValue.cs

Inizializza una nuova istanza della classe 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)

Parametri

scheme
String

Schema da usare per l'autorizzazione.

parameter
String

Le credenziali che contengono le informazioni di autenticazione dell'agente utente per la risorsa richiesta.

Commenti

Esempio:

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

Produrrà l'intestazione seguente:

Authorization: Bearer ACCESS_TOKEN

Si applica a