AuthenticationHeaderValue 构造函数
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
初始化 AuthenticationHeaderValue 类的新实例。
重载
| 名称 | 说明 |
|---|---|
| AuthenticationHeaderValue(String) |
初始化 AuthenticationHeaderValue 类的新实例。 |
| AuthenticationHeaderValue(String, String) |
初始化 AuthenticationHeaderValue 类的新实例。 |
AuthenticationHeaderValue(String)
- Source:
- AuthenticationHeaderValue.cs
- Source:
- AuthenticationHeaderValue.cs
- Source:
- AuthenticationHeaderValue.cs
- Source:
- AuthenticationHeaderValue.cs
- Source:
- 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
用于授权的方案。
注解
Example:
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)
- Source:
- AuthenticationHeaderValue.cs
- Source:
- AuthenticationHeaderValue.cs
- Source:
- AuthenticationHeaderValue.cs
- Source:
- AuthenticationHeaderValue.cs
- Source:
- 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
包含所请求资源的用户代理的身份验证信息的凭据。
注解
Example:
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