Argentini.Halide.H3ClientSide.SetCookie C# (CSharp) Method

SetCookie() public static method

Create a cookie on the client web browser.
public static SetCookie ( String cookieName, String cookieValue, String path, Int32 days ) : void
cookieName String Name of the cookie to create.
cookieValue String Cookie string value.
path String Virtual web path for cookie ownership (e.g. use "" for the root domain).
days System.Int32 Number of days until expiration.
return void
        public static void SetCookie(String cookieName, String cookieValue, String path, Int32 days)
        {
            HttpContext.Current.Response.Cookies[cookieName].Value = cookieValue;
            HttpContext.Current.Response.Cookies[cookieName].Expires = DateTime.Now.AddDays(days);

            if (!String.IsNullOrEmpty(path))
            {
                HttpContext.Current.Response.Cookies[cookieName].Path = path;
            }
        }

Same methods

H3ClientSide::SetCookie ( String cookieName, String cookieValue, String path, Int32 days, String domain ) : void