Is there any option like RelayStateCache.Add() & RelayState in ASP.net core ?

Hi Team ,

I’m working on migration for .NET 4.8 to .NET 6 core. one application from
Previously, we are using SAML2.Bindings. RelayStateCache and SAML2.Bindings. RelayState classes.
So, I’m looking similer functionality with ComponentSpace.Saml2 DLL.

I have some custom functionality depend on this 2 classes. While sending RelayState in SSO request and reading from response depend upon releayState we have some functionality, where relayState from response i need something unique that i can use to store some customerId along with that unique value and query once response received.
I read relayState is string, where we can pass return URL, I tried to pass GUID as relay state but it not worked.

can you suggest please how we can use relayState in this scnerio. what i could pass which should be something unique as relayState.

Looking for guidance.

The SAML for ASP.NET Core library doesn’t have a RelayStateCache.

Instead, I suggest using the IDistributedCache under the Microsoft.Extensions.Caching.Distributed namespace.

The relay state could be a GUID string and this is used as the key into the IDistributedCache for storing the customer ID and other related information.