SecurityTokenHandler.WriteToken Method (SecurityToken)

.NET Framework (current version)

The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

When overridden in a derived class, serializes the specified security token to a string. The token must be of the type processed by the derived class.

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

public virtual string WriteToken(
	SecurityToken token


Type: System.IdentityModel.Tokens.SecurityToken

The token to serialize.

Return Value

Type: System.String

The serialized token.

By default this method throws a NotImplementedException exception.

Override this method to provide the logic to serialize a security token to XML. If you override this method, you should also override the CanWriteToken property.

.NET Framework
Available since 4.5
Return to top