Walter.Web.FireWall
WriteCookieAsync Method (IUserIdentity)
Example 
Walter.Web.FireWall Assembly > Walter.Web.FireWall Namespace > IUserIdentity Interface : WriteCookieAsync Method
Cookie Name
Cookie value
set the expire options to use
indicates the cookie is essential default is false
optionally propagates notification that operations should be canceled.
Write the string to a persistent cookie using the GDPR compliant cipher with the users Salt as password
Syntax

Parameters

name
Cookie Name
value
Cookie value
expires
set the expire options to use
isEssential
indicates the cookie is essential default is false
cancellationToken
optionally propagates notification that operations should be canceled.
Remarks
This will cookie will not be accessible in JavaScript as it can't decipher the value
Example
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);
            
                }
Requirements

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

See Also

Reference

IUserIdentity Interface
IUserIdentity Members