Cookie provider

CookieProvider extracts options/prefernces from a cookie. Data are stored in the cookie in JSon format (url encoded) as an array of key value pair: [..., {Key: 'Html5InputSupport.number', Value: 2}, ...]

Its Prefix must be passed in the constructor, it has both save and auto create capabilities, and it is always Enabled when its WhenEnabled function is null, otherwise Enabled is set to the return value of this function.

Below the list of all provider specific properties:


        public string SourcePrefix { get; set; }
        public string CookieName { get; set; }
        public TimeSpan Duration { get; set; }
        public Func<HttpContext, bool>> WhenEnabled { get; set; }
        

With:

CookieName
Name of the cookie
Duration
Duration of the cookie. If not specified duration is set to one year
SourcePrefix
Prefix all source fields must have, to be processed by the provider. This prefix is removed before each field name is concatenated with Prefix to get the final path in the request dictionary.
WhenEnabled
Function used to customize the provider Enabled value.


Fork me on GitHub