JwtSecurityTokenHandler.WriteToken Method (SecurityToken)

Writes the JwtSecurityToken as a JSON Compact serialized format string.

Namespace:  System.IdentityModel.Tokens
Assembly:  System.IdentityModel.Tokens.Jwt (in System.IdentityModel.Tokens.Jwt.dll)

Syntax

'Declaration
Public Overridable Function WriteToken ( _
    token As SecurityToken _
) As String
public virtual string WriteToken(
    SecurityToken token
)
public:
virtual String^ WriteToken(
    SecurityToken^ token
)
abstract WriteToken : 
        token:SecurityToken -> string  
override WriteToken : 
        token:SecurityToken -> string
public function WriteToken(
    token : SecurityToken
) : String

Parameters

Return Value

Type: System.String
Returns String.

Exceptions

Exception Condition
ArgumentNullException

'token' is null.

ArgumentException

'token' is not a not JwtSecurityToken.

Remarks

If the SigningCredentials are not null, the encoding will contain a signature.

.NET Framework Security

See Also

Reference

JwtSecurityTokenHandler Class

WriteToken Overload

System.IdentityModel.Tokens Namespace