Exemple #1
0
        public static bool IsCookieExist(string cookieName, bool modifyName = true)
        {
            bool       isCookieExist = false;
            HttpCookie userCookie    = CookiesRequest.Get(cookieName);

            if (userCookie != null)
            {
                isCookieExist = true;
            }

            return(isCookieExist);
        }
Exemple #2
0
        public static string GetCookieValue(string cookieName, string key = "Id", bool modifyName = true)
        {
            string cookieValue = string.Empty;

            if (IsCookieExist(cookieName, false))
            {
                HttpCookie cookie = CookiesRequest.Get(cookieName);
                if (cookie != null)
                {
                    cookieValue = cookie[key] ?? string.Empty;
                }
            }

            cookieValue = DecodeCookieValue(cookieValue);

            return(cookieValue);
        }