Write the string to a persistent cookie using the GDPR compliant cipher with the users Salt as password
This sample shows how the user stores GDPR specific data securely using the users unique cypher key
public class ShopController : Controller
{
private readonly IPageRequest _page;
private ILatLongRepository _latLongRepository;
public ShopController(IPageRequest page, ILatLongRepository latLongRepository)
{
_page = page;
_latLongRepository = latLongRepository;
}
public async Task<IActionResult> Index(ShoppingCard data)
{
int cardId = -1;
if (_page.User.TryReadCookie("CredidCardId", out var sValue) && int.TryParse(sValue, out cardId))
{
//some magic code
}
await _page.User.WriteCookieAsync("CredidCardId", cardId.ToString(CultureInfo.InvariantCulture)).ConfigureAwait(false);
}
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2