Esempio n. 1
0
        private bool ValidateTicket(string encrypted)
        {
            var username = CppTokenHolder.ExtractName(encrypted);

            //var str = HttpContext.Current.Session[username];
            //return str == null ? false : encrypted.Equals(str.ToString());
            return(username != null);
        }
Esempio n. 2
0
        public static string GetUsernameFromCookie()
        {
            string username = null;

            try
            {
                HttpCookieCollection cookies = HttpContext.Current.Request.Cookies;
                HttpCookie           cookie  = cookies.Get("Token");
                username = CppTokenHolder.ExtractName(cookie.Value);
            }
            catch (NullReferenceException)
            {
            }
            catch (Exception)
            {
            }
            return(username);
        }