Walter.Web.FireWall
WriteCookie(String,String,TimeSpan,Boolean) Method
Example 
Walter.Web.FireWall Assembly > Walter.Web.FireWall Namespace > IUserIdentity Interface > WriteCookie Method : WriteCookie(String,String,TimeSpan,Boolean) Method
Cookie Name
Cookie value
set the expire options to use
indicates the cookie is essential default is false
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
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       
        }
   
        _page.User.WriteCookie("CredidCardId", cardId.ToString(CultureInfo.InvariantCulture), TimeSpan.FromDays(30));
        
   }
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
Overload List