Note

Access to this page requires authorization. You can try signing in or .

Access to this page requires authorization. You can try .

SqlConnection.AccessToken Property

Definition

Namespace:
Microsoft.Data.SqlClient
Assembly:
Microsoft.Data.SqlClient.dll
Package:
Microsoft.Data.SqlClient v1.0.19269.1
Package:
Microsoft.Data.SqlClient v1.1.4
Package:
Microsoft.Data.SqlClient v2.0.1
Package:
Microsoft.Data.SqlClient v2.1.4
Package:
Microsoft.Data.SqlClient v3.0.1
Package:
Microsoft.Data.SqlClient v3.1.0
Package:
Microsoft.Data.SqlClient v4.0.1
Package:
Microsoft.Data.SqlClient v4.1.0
Package:
Microsoft.Data.SqlClient v5.0.0
Package:
Microsoft.Data.SqlClient v5.1.0
Package:
Microsoft.Data.SqlClient v5.2.0
Package:
Microsoft.Data.SqlClient v6.0.2
Package:
Microsoft.Data.SqlClient v6.1.3
Package:
Microsoft.Data.SqlClient v7.0.1
Source:
SqlConnection.cs
Source:
SqlConnection.cs
Source:
SqlConnection.cs
Source:
SqlConnection.cs

Important

Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

Gets or sets the access token for the connection.

public:
 property System::String ^ AccessToken { System::String ^ get(); void set(System::String ^ value); };
[System.ComponentModel.Browsable(false)]
public string AccessToken { get; set; }
public string AccessToken { get; set; }
[<System.ComponentModel.Browsable(false)>]
member this.AccessToken : string with get, set
member this.AccessToken : string with get, set
Public Property AccessToken As String

Property Value

The access token for the connection.

Attributes

Exceptions

The AccessToken is combined with other conflicting authentication configurations.

Remarks

The AccessToken is a part of the connection pool key. Supplying a refreshed access token to a new connection, with all other properties the same as other existing connections, will place that new connection into a new pool. Care should be taken when using this property to manage your own access token. Consider using the AccessTokenCallback property instead, which will not consider refreshed access tokens as distinct for the purposes of connection pooling.

The application is responsible for knowing when the access token expires and the connections from the pool should no longer be used. If you set a minimum pool size > 0 along with an AccessToken, you must call ClearPool(SqlConnection) after the access token expires to ensure the connection pool doesn't maintain the physical connections (created by the pool) indefinitely.

This property is mutually exclusive with the AccessTokenCallback property, among others.

Applies to